コード例 #1
0
 /**
  * Get all groups method
  *
  * @param  string $sort
  * @param  string $page
  * @return void
  */
 public function getAll($sort = null, $page = null)
 {
     $order = $this->getSortOrder($sort, $page);
     $groups = Table\FieldGroups::findAll($order['field'] . ' ' . $order['order'], null, $order['limit'], $order['offset']);
     if ($this->data['acl']->isAuth('Phire\\Controller\\Phire\\Structure\\GroupsController', 'remove')) {
         $removeCheckbox = '<input type="checkbox" name="remove_groups[]" id="remove_groups[{i}]" value="[{id}]" />';
         $removeCheckAll = '<input type="checkbox" id="checkall" name="checkall" value="remove_groups" />';
         $submit = array('class' => 'remove-btn', 'value' => $this->i18n->__('Remove'));
     } else {
         $removeCheckbox = '&nbsp;';
         $removeCheckAll = '&nbsp;';
         $submit = array('class' => 'remove-btn', 'value' => $this->i18n->__('Remove'), 'style' => 'display: none;');
     }
     $options = array('form' => array('id' => 'field-group-remove-form', 'action' => BASE_PATH . APP_URI . '/structure/groups/remove', 'method' => 'post', 'process' => $removeCheckbox, 'submit' => $submit), 'table' => array('headers' => array('id' => '<a href="' . BASE_PATH . APP_URI . '/structure/groups?sort=id">#</a>', 'edit' => '<span style="display: block; margin: 0 auto; width: 100%; text-align: center;">' . $this->i18n->__('Edit') . '</span>', 'name' => '<a href="' . BASE_PATH . APP_URI . '/structure/groups?sort=name">' . $this->i18n->__('Name') . '</a>', 'order' => '<a href="' . BASE_PATH . APP_URI . '/structure/groups?sort=order">' . $this->i18n->__('Order') . '</a>', 'process' => $removeCheckAll), 'class' => 'data-table', 'cellpadding' => 0, 'cellspacing' => 0, 'border' => 0), 'separator' => '', 'indent' => '        ', 'exclude' => 'dynamic');
     if (isset($groups->rows[0])) {
         $groupsAry = array();
         foreach ($groups->rows as $group) {
             if ($this->data['acl']->isAuth('Phire\\Controller\\Phire\\Structure\\GroupsController', 'edit')) {
                 $edit = '<a class="edit-link" title="' . $this->i18n->__('Edit') . '" href="' . BASE_PATH . APP_URI . '/structure/groups/edit/' . $group->id . '">Edit</a>';
             } else {
                 $edit = null;
             }
             $gAry = array('id' => $group->id, 'name' => $group->name, 'order' => $group->order);
             if (null !== $edit) {
                 $gAry['edit'] = $edit;
             }
             $groupsAry[] = $gAry;
         }
         $this->data['table'] = Html::encode($groupsAry, $options, $this->config->pagination_limit, $this->config->pagination_range, Table\FieldGroups::getCount());
     }
 }