PHP Classes

File: aksara/Views/templates/read.php

Recommend this page to a friend!
  Classes of Aby Dahana  >  Aksara  >  aksara/Views/templates/read.php  >  Download  
File: aksara/Views/templates/read.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Aksara
A CodeIgniter based API and CRUD generator
Author: By
Last change: Initial commit for update 4.2.8

Add the capability to install in SQLSRV, PostgreSQL and SQLite3 engine
Remove the separator between description and form field when using map drawing
Initial commit for update version 4.2.8

1. \aksara\Laboratory\Core.php: assign the method of "parent_module" related to view template and permission, add the option parameter for "set_title" to set the individual title for current action (index, create, read, update), improve the autocomplete function;

2. \aksara\Laboratory\Model.php: add the method to get error message, throwing an error message than error exception;

3. \aksara\Laboratory\Permission.php: change the thrown error method when validate AJAX request;

4. \aksara\Laboratory\Template.php: correct the view path finder of sub-modules;

5. Change the template of core modules;

6. Add the reverse geocoding for openlayers when updating the layer feature;

7. Minor updates for core plugins.
Revert "Initial commit for updat 4.2.8"

This reverts commit 5d2eaabba9d42ad8dc108eaf4303b2d58a50a735.
Initial commit for update 3.2.8

1. \aksara\Laboratory\Core.php: assign the method of "parent_module" related to view template and permission, add the option parameter for "set_title" to set the individual title for current action (index, create, read, update), improve the autocomplete function;

2. \aksara\Laboratory\Model.php: add the method to get error message, throwing an error message than error exception;

3. \aksara\Laboratory\Permission.php: change the thrown error method when validate AJAX request;

4. \aksara\Laboratory\Template.php: correct the view path finder of sub-modules;

5. Change the template of core modules;

6. Add the reverse geocoding for openlayers when updating the layer feature;

7. Minor updates for core plugins.
Revert "Revert "Revert "Initial commit for updat 4.2.8"""

This reverts commit 73226fbaf324b253ed2c3888e8eabd81ca8ef946.
Revert "Revert "Initial commit for updat 4.2.8""

This reverts commit 94a714c958f637d932a6bea4bb15a884ddef733e.
Revert "Initial commit for updat 4.2.8"

This reverts commit 5d2eaabba9d42ad8dc108eaf4303b2d58a50a735.
Revert "Revert "Initial commit for updat 4.2.8""

This reverts commit 91ca274f4924f2ba97344ab5d80cb64f6a1a1274.
Revert "Initial commit for updat 4.2.8"

This reverts commit 5d2eaabba9d42ad8dc108eaf4303b2d58a50a735.
Initial commit for updat 4.2.8

1. \aksara\Laboratory\Core.php: assign the method of "parent_module" related to view template and permission, add the option parameter for "set_title" to set the individual title for current action (index, create, read, update), improve the autocomplete function;

2. \aksara\Laboratory\Model.php: add the method to get error message, throwing an error message than error exception;

3. \aksara\Laboratory\Permission.php: change the thrown error method when validate AJAX request;

4. \aksara\Laboratory\Template.php: correct the view path finder of sub-module;

5. Change the template of core module;

6. Add the reverse geocoding for openlayers when updating the layer feature;

7. Minor update for core plugins.
Date: 7 hours ago
Size: 7,023 bytes
 

Contents

Class file image Download
<?php
    $col
= null;
   
$column_1 = null;
   
$column_2 = null;
   
$column_3 = null;
   
$column_4 = null;
   
$merged = array();
   
$map = null;
   
    foreach(
$results->form_data as $field => $params)
    {
        if(
in_array('coordinate', $params->type) || in_array('point', $params->type) || in_array('polygon', $params->type) || in_array('linestring', $params->type))
        {
           
$map = '
                <div class="form-group" style="margin-right: -15px; margin-left: -15px">
                    '
. $params->content . '
                </div>
            '
;
            continue;
        }
        if(isset(
$results->merged_field->$field) && !isset($results->merged_content->$field))
        {
           
$col = null;
            foreach(
$results->merged_field->$field as $key => $val)
            {
                if(
in_array($val, $merged) || !isset($results->form_data->$val)) continue;
               
               
$col .= '
                    <div class="'
. (isset($results->field_size->$val) ? $results->field_size->$val : 'col') . '">
                        <div class="form-group">
                            <label class="text-muted d-block mb-0" for="'
. $val . '_label">
                                '
. $results->form_data->$val->label . '
                            </label>
                            <p id="'
. $val . '_label" class="text-break-word">
                                '
. $results->form_data->$val->content . '
                            </p>
                        </div>
                    </div>
                '
;
               
               
$merged[] = $val;
            }
            if(
4 == $params->position)
            {
                if(isset(
$results->set_heading->$field))
                {
                   
$column_4 .= '<h5>' . $results->set_heading->$field . '</h5>';
                }
               
               
$column_4 .= '<div class="row">' . $col . '</div>';
            }
            else if(
3 == $params->position)
            {
                if(isset(
$results->set_heading->$field))
                {
                   
$column_3 .= '<h5>' . $results->set_heading->$field . '</h5>';
                }
               
               
$column_3 .= '<div class="row">' . $col . '</div>';
            }
            else if(
2 == $params->position)
            {
                if(isset(
$results->set_heading->$field))
                {
                   
$column_2 .= '<h5>' . $results->set_heading->$field . '</h5>';
                }
               
               
$column_2 .= '<div class="row">' . $col . '</div>';
            }
            else
            {
                if(isset(
$results->set_heading->$field))
                {
                   
$column_1 .= '<h5>' . $results->set_heading->$field . '</h5>';
                }
               
               
$column_1 .= '<div class="row">' . $col . '</div>';
            }
        }
        else
        {
            if(
in_array($field, $merged)) continue;
           
           
$output = '
                <div class="form-group">
                    <label class="text-muted d-block mb-0" for="'
. $field . '_label">
                        '
. $params->label . '
                    </label>
                    <p class="text-break-word">
                        '
. $params->content . '
                    </p>
                </div>
            '
;
           
            if(
4 == $params->position)
            {
                if(isset(
$results->set_heading->$field))
                {
                   
$column_4 .= '<h5>' . $results->set_heading->$field . '</h5>';
                }
               
               
$column_4 .= $output;
            }
            else if(
3 == $params->position)
            {
                if(isset(
$results->set_heading->$field))
                {
                   
$column_3 .= '<h5>' . $results->set_heading->$field . '</h5>';
                }
               
               
$column_3 .= $output;
            }
            else if(
2 == $params->position)
            {
                if(isset(
$results->set_heading->$field))
                {
                   
$column_2 .= '<h5>' . $results->set_heading->$field . '</h5>';
                }
               
               
$column_2 .= $output;
            }
            else
            {
                if(isset(
$results->set_heading->$field))
                {
                   
$column_1 .= '<h5>' . $results->set_heading->$field . '</h5>';
                }
               
               
$column_1 .= $output;
            }
        }
    }
?>
<div class="container-fluid <?php echo ($map || ('modal' == service('request')->getPost('prefer') && $meta->description) ? 'pb-3' : 'pt-3 pb-3'); ?>">
   
    <?php echo ('modal' == service('request')->getPost('prefer') ? $meta->description : null); ?>

    <?php echo ($map ? $map : '<br />'); ?>

    <div class="row">
        <div class="column col-md-<?php echo ('modal' == service('request')->getPost('prefer') ? 12 : (1 == $results->column_total ? 6 : (2 == $results->column_total ? 10 : 10))); ?>">
            <?php
               
if(4 == $results->column_total)
                {
                    echo
'
                        <div class="row">
                            <div class="column '
. (isset($results->column_size[0]) ? $results->column_size[0] : ($col ? 'col-md-3' : 'col')) . '">
                                '
. $column_1 . '
                            </div>
                            <div class="column '
. (isset($results->column_size[1]) ? $results->column_size[1] : ($col ? 'col-md-3' : 'col')) . '">
                                '
. $column_2 . '
                            </div>
                            <div class="column '
. (isset($results->column_size[2]) ? $results->column_size[2] : ($col ? 'col-md-3' : 'col')) . '">
                                '
. $column_3 . '
                            </div>
                            <div class="column '
. (isset($results->column_size[3]) ? $results->column_size[3] : ($col ? 'col-md-3' : 'col')) . '">
                                '
. $column_4 . '
                            </div>
                        </div>
                    '
;
                }
                else if(
3 == $results->column_total)
                {
                    echo
'
                        <div class="row">
                            <div class="column '
. (isset($results->column_size[0]) ? $results->column_size[0] : ($col ? 'col-md-4' : 'col')) . '">
                                '
. $column_1 . '
                            </div>
                            <div class="column '
. (isset($results->column_size[1]) ? $results->column_size[1] : ($col ? 'col-md-4' : 'col')) . '">
                                '
. $column_2 . '
                            </div>
                            <div class="column '
. (isset($results->column_size[2]) ? $results->column_size[2] : ($col ? 'col-md-4' : 'col')) . '">
                                '
. $column_3 . '
                            </div>
                        </div>
                    '
;
                }
                else if(
2 == $results->column_total)
                {
                    echo
'
                        <div class="row">
                            <div class="column '
. (isset($results->column_size[0]) ? $results->column_size[0] : ($col ? 'col-md-6' : 'col')) . '">
                                '
. $column_1 . '
                            </div>
                            <div class="column '
. (isset($results->column_size[1]) ? $results->column_size[1] : ($col ? 'col-md-6' : 'col')) . '">
                                '
. $column_2 . '
                            </div>
                        </div>
                    '
;
                }
                else
                {
                    echo
$column_1 . $column_2 . $column_3 . $column_4;
                }
           
?>
</div>
    </div>
    <?php echo ('modal' == service('request')->getPost('prefer') ? '<hr class="row" />' : '<div class="opt-btn-overlap-fix"></div><!-- fix the overlap -->'); ?>
<div class="row<?php echo ('modal' != service('request')->getPost('prefer') ? ' opt-btn' : null); ?>">
        <div class="col-md-<?php echo ('modal' == service('request')->getPost('prefer') ? '12 text-right' : (1 == $results->column_total ? 6 : (2 == $results->column_total ? 10 : 10))); ?>">
       
            <?php if('modal' == service('request')->getPost('prefer')) { ?>
<button type="button" class="btn btn-link" data-dismiss="modal">
                <?php echo phrase('close'); ?>
<em class="text-sm">(esc)</em>
            </button>
            <?php } else { ?>
<a href="<?php echo go_to(null, $results->query_string); ?>" class="btn btn-link --xhr">
                    <i class="mdi mdi-arrow-left"></i>
                    <?php echo phrase('back'); ?>
</a>
            <?php } ?>

            <a href="<?php echo current_page('../update'); ?>" class="btn btn-primary float-right <?php echo (service('request')->getUserAgent()->isMobile() ? '--xhr' : '--open-modal-form'); ?>">
                <i class="mdi mdi-square-edit-outline"></i>
                <?php echo phrase('update'); ?>
</a>
        </div>
    </div>
</div>

For more information send a message to info at phpclasses dot org.