Esempio n. 1
0
 /**
  * Get tag content
  *
  * @param  Table\Tags          $tag
  * @param  \Pop\Module\Manager $modules
  * @return void
  */
 protected function getTag(Table\Tags $tag, \Pop\Module\Manager $modules)
 {
     if ($modules->isRegistered('phire-fields')) {
         $t = \Phire\Fields\Model\FieldValue::getModelObject('Phire\\Tags\\Model\\Tag', [$tag->id]);
         $data = $t->toArray();
     } else {
         $data = $tag->getColumns();
     }
     $items = [];
     $c2t = Table\TagItems::findBy(['tag_id' => $tag->id], ['order' => 'content_id DESC']);
     if ($c2t->hasRows()) {
         foreach ($c2t->rows() as $c) {
             if ($modules->isRegistered('phire-fields')) {
                 $item = \Phire\Fields\Model\FieldValue::getModelObject('Phire\\Content\\Model\\Content', [$c->content_id], 'getById', $modules['phire-tags']['filters']);
             } else {
                 $class = 'Phire\\Content\\Model\\Content';
                 $model = new $class();
                 call_user_func_array([$model, 'getById'], [$c->content_id]);
                 $item = $model;
             }
             if ($item->status == 1 && count($item->roles) == 0) {
                 $items[$item->id] = new \ArrayObject($item->toArray(), \ArrayObject::ARRAY_AS_PROPS);
             }
         }
     }
     $data['items'] = $items;
     $this->data = array_merge($this->data, $data);
 }
Esempio n. 2
0
 /**
  * Delete tag relationships
  *
  * @param  AbstractController $controller
  * @param  Application        $application
  * @return void
  */
 public static function delete(AbstractController $controller, Application $application)
 {
     if ($_POST && isset($_POST['process_content']) && isset($_POST['content_process_action']) && $_POST['content_process_action'] == -3) {
         foreach ($_POST['process_content'] as $id) {
             $c2t = new Table\TagItems();
             $c2t->delete(['content_id' => (int) $id]);
         }
     }
 }