Пример #1
0
 protected function getContentByCategoryId($category_id)
 {
     //pega a CategoryVO
     $CategoryVO = new CategoryVO();
     $CategoryVO->setId($category_id, TRUE);
     $conteudos = $CategoryVO->getLinks("content", 1);
     if (is_array($conteudos) && count($conteudos) > 0) {
         $Link = $conteudos[0];
         $ContentVO = new ContentVO();
         $ContentVO->setId($Link->linked_table_id, TRUE);
         return $ContentVO->getContent();
         //Debug::print_r($ContentVO);
     }
     return "";
 }
Пример #2
0
 public function insert()
 {
     //inicia um retorno de ReturnResultVO
     $ReturnResultVO = new ReturnResultVO();
     //pega os dados baseado na ContentInfoPostVO
     $VO = new ContentVO();
     //popula no objeto
     if ($this->ContentInfoPostVO->id) {
         $VO->setId($this->ContentInfoPostVO->id, TRUE);
     }
     $VO->setActive($this->ContentInfoPostVO->active);
     $VO->setName($this->ContentInfoPostVO->name);
     $VO->setTitle($this->ContentInfoPostVO->title, $this->ContentInfoPostVO->request_locale);
     $VO->setHat($this->ContentInfoPostVO->hat, $this->ContentInfoPostVO->request_locale);
     $VO->setDescription($this->ContentInfoPostVO->description, $this->ContentInfoPostVO->request_locale);
     $VO->setContent($this->ContentInfoPostVO->content, $this->ContentInfoPostVO->request_locale);
     $VO->setAuthor($this->ContentInfoPostVO->author);
     $VO->setTemplateUrl($this->ContentInfoPostVO->template_url, $this->ContentInfoPostVO->request_locale);
     $VO->setSlug($this->ContentInfoPostVO->slug, $this->ContentInfoPostVO->request_locale);
     $VO->setKeyWords($this->ContentInfoPostVO->key_words, $this->ContentInfoPostVO->request_locale);
     $VO->setDate($this->ContentInfoPostVO->date);
     $VO->setDateIn($this->ContentInfoPostVO->date_in);
     $VO->setDateOut($this->ContentInfoPostVO->date_out);
     $VO->setOrder($this->ContentInfoPostVO->order);
     include "";
     //("Ja") gera id para criar pasta onde vai ser guardado o arquivo
     $ReturnResultContentVO = $VO->commit();
     if ($ReturnResultContentVO->success) {
         $ReturnResultContentVO->result = $VO->getId();
         // TODO: AQ ADD IMGAGE  e/ou FILE - $arr_uploaded_files
         // $this->ContentInfoPostVO->arr_uploaded_files['image'][0]->table 		= 'content';
         // $this->ContentInfoPostVO->arr_uploaded_files['image'][0]->table_id 	= $ReturnResultContentVO->result ;
         // $facilFile = new FacilImage( $this->ContentInfoPostVO->arr_uploaded_files['image'][0])
         // $facilFile = new FacilFile( $this->ContentInfoPostVO->arr_uploaded_files['file'][0])
     }
     if ($ReturnResultContentVO->success) {
         //incluir o vinculo com a linked_table e linked_table_id
         //receber 	table
         //			table_id
         if ($this->ContentInfoPostVO->request_table != NULL && $this->ContentInfoPostVO->request_table_id > 0) {
             $table = $this->ContentInfoPostVO->request_table;
             $table_id = $this->ContentInfoPostVO->request_table_id;
             include_once "library/facil3/core/dao/LinkDAO.class.php";
             $LinkDAO = new LinkDAO();
             //vincula a foto ao table e table_id enviado
             $ReturnResultVinculoVO = $LinkDAO->insert($table, $table_id, $this->moduleName, $VO->getId(), 1);
             if (!$ReturnResultVinculoVO->success) {
                 //deu erro ao vincular
                 $ReturnResultContentVO->appendMessage($ReturnResultVinculoVO->array_messages);
             }
         }
     }
     return $ReturnResultContentVO;
 }
Пример #3
0
 /**
  * Envie o novo estado de active 
  */
 public function updateActive()
 {
     $active = DataHandler::forceInt(DataHandler::getValueByArrayIndex($this->arrayVariable, "active"));
     $id = DataHandler::forceInt(DataHandler::getValueByArrayIndex($this->arrayVariable, "id"));
     $ContentVO = new ContentVO();
     $ContentVO->setId($id, TRUE);
     $ContentVO->setActive($active);
     $Result = $ContentVO->commit();
     echo $Result->toJson();
     exit;
 }