Ejemplo n.º 1
0
 /**
  * Proxy for getModel.
  * @since	1.6
  */
 public function &getModel($name = 'Element', $prefix = 'FabrikModel')
 {
     $config = array();
     $config['ignore_request'] = true;
     $model = parent::getModel($name, $prefix, $config);
     return $model;
 }
Ejemplo n.º 2
0
 /**
  * Method to publish a list of taxa
  *
  * @since	1.6
  */
 function publish()
 {
     $cid = JRequest::getVar('cid', array(), '', 'array');
     $data = array('publish' => 1, 'unpublish' => 0, 'archive' => 2, 'trash' => -2, 'report' => -3);
     $task = $this->getTask();
     $value = JArrayHelper::getValue($data, $task, 0, 'int');
     if (empty($cid)) {
         JError::raiseWarning(500, JText::_($this->text_prefix . '_NO_ITEM_SELECTED'));
     } else {
         // Make sure the item ids are integers
         JArrayHelper::toInteger($cid);
         $model = $this->getModel('Form');
         $formids = $model->swapListToFormIds($cid);
         // Publish the items.
         $formKeys = array();
         if (!$model->publish($formids, $value)) {
             JError::raiseWarning(500, $model->getError());
         } else {
             //publish the groups
             $groupModel = $this->getModel('Group');
             if (is_object($groupModel)) {
                 $groupids = $groupModel->swapFormToGroupIds($formids);
                 if (!empty($groupids)) {
                     if ($groupModel->publish($groupids, $value) === false) {
                         JError::raiseWarning(500, $groupModel->getError());
                     } else {
                         //publish the elements
                         $elementModel = $this->getModel('Element');
                         $elementIds = $elementModel->swapGroupToElementIds($groupids);
                         if (!$elementModel->publish($elementIds, $value)) {
                             JError::raiseWarning(500, $elementModel->getError());
                         }
                     }
                 }
             }
             //finally publish the table
             parent::publish();
         }
     }
     $this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list, false));
 }
Ejemplo n.º 3
0
 /**
  * Proxy for getModel.
  *
  * @param   string  $name    model name
  * @param   string  $prefix  model prefix
  * @param   array   $config  Configuration array for model. Optional.
  *
  * @return  J model
  */
 public function getModel($name = 'Cron', $prefix = 'FabrikAdminModel', $config = array())
 {
     $model = parent::getModel($name, $prefix, array('ignore_request' => true));
     return $model;
 }
Ejemplo n.º 4
0
 /**
  * Proxy for getModel.
  *
  * @param   string  $name    model name
  * @param   string  $prefix  model prefix
  *
  * @return  J model
  */
 public function &getModel($name = 'Cron', $prefix = 'FabrikModel')
 {
     $model = parent::getModel($name, $prefix, array('ignore_request' => true));
     return $model;
 }
Ejemplo n.º 5
0
 /**
  * Method to publish a list of items
  *
  * @return  null
  */
 public function publish()
 {
     $app = JFactory::getApplication();
     $input = $app->input;
     $cid = $input->get('cid', array(), 'array');
     $model = $this->getModel('Elements');
     $task = $this->getTask();
     if ($task === 'unpublish') {
         $cid = $model->canUnpublish($cid);
         $input->set('cid', $cid);
     }
     if (empty($cid)) {
         $this->setRedirect('index.php?option=com_fabrik&view=elements');
     } else {
         parent::publish();
     }
 }
Ejemplo n.º 6
0
 /**
  * Method to publish a list of items
  *
  * @return  null
  */
 public function publish()
 {
     $input = $this->input;
     $cid = $input->get('cid', array(), 'array');
     $data = array('publish' => 1, 'unpublish' => 0, 'archive' => 2, 'trash' => -2, 'report' => -3);
     $task = $this->getTask();
     $value = FArrayHelper::getValue($data, $task, 0, 'int');
     if (empty($cid)) {
         $this->setMessage(FText::_($this->text_prefix . '_NO_ITEM_SELECTED'), 'error');
     } else {
         // Make sure the item ids are integers
         $cid = ArrayHelper::toInteger($cid);
         $model = $this->getModel('Form', 'FabrikAdminModel');
         $formIds = $model->swapListToFormIds($cid);
         // Publish the items.
         if (!$model->publish($formIds, $value)) {
             $this->setMessage($model->getError(), 'error');
         } else {
             // Publish the groups
             $groupModel = $this->getModel('Group');
             if (is_object($groupModel)) {
                 $groupIds = $groupModel->swapFormToGroupIds($formIds);
                 if (!empty($groupIds)) {
                     if ($groupModel->publish($groupIds, $value) === false) {
                         $this->setMessage($groupModel->getError(), 'error');
                     } else {
                         // Publish the elements
                         $elementModel = $this->getModel('Element');
                         $elementIds = $elementModel->swapGroupToElementIds($groupIds);
                         if (!$elementModel->publish($elementIds, $value)) {
                             $this->setMessage($elementModel->getError(), 'error');
                         }
                     }
                 }
             }
             // Finally publish the list
             parent::publish();
         }
     }
     $this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list, false));
 }