コード例 #1
0
 /**
  * Function to show the view/add category page
  * @param  :
  * @author : Vishal
  * @since  : 24-05-2012
  * @return
  */
 function category($action)
 {
     $this->sitelogin->entryAdminCheck();
     $data['title'] = 'Category management';
     if ($action == 'view') {
         $categoryCount = getcategoryList();
         $count = count($categoryCount);
         $this->load->library('pagination');
         $config['uri_segment'] = 4;
         $config['base_url'] = site_url('administrator/category/view/');
         $offset = $this->uri->segment(4, 0);
         $config['total_rows'] = $count;
         $config['first_link'] = 'First';
         $config['per_page'] = $limit = 10;
         $this->pagination->initialize($config);
         $data['category'] = $category = $this->admin_model->getCategory($limit, $offset);
         $this->load->view('admin/admin_category_view', $data);
     } elseif ($action == 'add') {
         $data['title'] = 'Add category';
         $this->load->view('admin/admin_category_add', $data);
     }
 }
" id="board_name" /></td>
                                    <td><div id="error_name" class="validation-message"></div></td>
                                </tr>
                                <tr>
                                    <td><label>Description</label></td>
                                    <td><textarea rows="2" name="description" maxlength="500" id="description" cols="40" class="expand autocomplete_desc" style="width:316px;height: 31px;"><?php 
echo $result->description;
?>
</textarea></td>
                                    <td><div id="error_description" class="validation-message"></div></td>
                                </tr>
                                <tr>
                                    <td><label><label for="category">Category</label></label></td>
                                    <td>
                                        <?php 
$category = getcategoryList();
?>
                                        <select name="category" id="category">
                                            <?php 
foreach ($category as $categoryKey => $categoryValues) {
    ?>
                                                <?php 
    $selected = $categoryValues->field == $result->category ? 'selected' : '';
    ?>
                                                <option <?php 
    echo $selected;
    ?>
 value="<?php 
    echo $categoryValues->field;
    ?>
"><?php