Exemplo n.º 1
0
 public function optionGroups($rtrn = 'list', $filters = array())
 {
     if (isset($filters['sort'])) {
         if ($filters['sort'] == 'title') {
             $filters['sort'] = 'ogName';
         }
         if ($filters['sort'] == 'state') {
             $filters['sort'] = 'ogActive';
         }
     }
     if (!isset($filters['sort_Dir'])) {
         $filters['sort_Dir'] = 'ASC';
     }
     switch (strtolower($rtrn)) {
         case 'count':
             $warehouse = new Warehouse();
             $count = $warehouse->getOptionGroups('count');
             return $count;
             break;
         case 'list':
         case 'rows':
         case 'results':
         default:
             $warehouse = new Warehouse();
             if (!($results = $warehouse->getOptionGroups('rows', $filters))) {
                 $results = array();
             }
             $categories = new \Hubzero\Base\ItemList($results);
             return $categories;
             break;
     }
 }
Exemplo n.º 2
0
 /**
  * Edit a category
  *
  * @return  void
  */
 public function editTask($row = null)
 {
     Request::setVar('hidemainmenu', 1);
     $obj = new Archive();
     if (is_object($row)) {
         $id = $row->getId();
         // If this is a new option, set option group ID
         if (!$id) {
             $ogId = Request::getVar('ogId');
             $row->setOptionGroupId($ogId);
         }
         $this->view->row = $row;
         $this->view->task = 'edit';
     } else {
         // Incoming
         $id = Request::getVar('id', array(0));
         if (is_array($id) && !empty($id)) {
             $id = $id[0];
         }
         // Get option
         $row = $obj->option($id);
         $this->view->row = $row;
         // If this is a new option, set option group ID
         if (!$id) {
             $ogId = Request::getVar('ogId');
             $row->setOptionGroupId($ogId);
         }
     }
     //print_r($row); die;
     // Get option group's info
     $ogId = $row->getOptionGroupId();
     $warehouse = new Warehouse();
     $ogInfo = $warehouse->getOptionGroups('list', $filters = array('ids' => $ogId));
     $this->view->ogInfo = $ogInfo[0];
     //print_r($ogInfo); die;
     // Set any errors
     foreach ($this->getErrors() as $error) {
         $this->view->setError($error);
     }
     // Output the HTML
     $this->view->setLayout('edit')->display();
 }