Пример #1
0
 private function createFormData($ReturnResultVO = NULL)
 {
     //adiciona o content na url de envio do formulario
     if ($this->content_id > 0) {
         $this->my_action .= "/id.{$this->content_id}/";
     }
     //echo $this->my_action;
     $formData = new ContentFormView($this->ContentSiteVO, Config::getRootPath($this->my_action));
     $ImageFormView = new ImageFormView();
     $ImageFormView->setFormLabel("Selecionar Foto");
     $ImageFormView->setShowImageUrl(TRUE);
     //		$ImageFormView->setName(array("label"=>"link", "visible"=>TRUE));
     if ($this->sub == "unidades") {
         $ImageFormView->setQuantity(0);
     } else {
         $ImageFormView->setQuantity(1);
     }
     //		$ImageFormView->setDescription(array('label'=>Translation::text('Link'), 'visible'=>false, 'type'=>'simpleText'));
     $FileFormView = new FileFormView();
     $FileFormView->setFormLabel("Selecionar Arquivo");
     $FileFormView->setQuantity($this->total_files);
     if ($this->sub == "blog") {
         //id do blog 36
         $CategoryVO = new CategoryVO();
         $CategoryVO->setId(36, TRUE);
         $array_categorias = $CategoryVO->selectCascade(CategoryDAO::RETURN_STD_OBJECT, 1);
         $selected_category = array();
         $LinkDAO = LinkDAO::getInstance();
         if (FALSE) {
             $LinkDAO = new LinkDAO();
         }
         if ($this->ContentSiteVO->id > 0) {
             $ReturnLinkCategory = $LinkDAO->select(LinkDAO::RETURN_STD_OBJECT, NULL, NULL, "content", $this->ContentSiteVO->id, 1);
             if ($ReturnLinkCategory->success && $ReturnLinkCategory->count_total > 0) {
                 foreach ($ReturnLinkCategory->result as $link_std) {
                     $selected_category[] = $link_std->table_id;
                 }
             }
         }
         //Debug::print_r($ReturnLinkCategory);exit();
         //new ContentSiteVO();
         $formData->setCategory(array("visible" => TRUE, "name" => "category[]", "label" => "Categorias", "selected" => $selected_category, "options" => $array_categorias));
     } else {
         $formData->setCategory(array("visible" => FALSE, "name" => "category[]", "selected" => array($this->category_id)));
     }
     if ($this->sub == "unidades") {
         $formData->setContent(array("label" => "Endereço:", "value" => "unidade"));
     } else {
         //trocando o rótulo para Content
         $formData->setContent(array("label" => "Descrição:"));
     }
     //trocando o rótulo para Title
     $formData->setTitle(array("label" => "Titulo:"));
     //		$formData->setHat(array("label"=>"Link:"));
     $formData->setDate(array("label" => "Data(formato: dd/mm/aaaa hh:mm:ss para 'agora' deixe vazio):"));
     $formData->setImage($ImageFormView);
     $formData->setFile($FileFormView);
     $array_to_visible_false = array('Name', 'Hat', 'Description', 'Author', 'TemplateUrl', 'Slug', 'KeyWords', 'DateIn', 'DateOut', 'Order');
     if ($this->sub == "unidades") {
         $array_to_visible_false = array('Name', 'Description', 'Content', 'TemplateUrl', 'Slug', 'KeyWords', 'Date', 'DateIn', 'DateOut', 'Order');
         $formData->setHat(array("label" => "Endereço"));
         $formData->setAuthor(array("label" => "Link Mapa"));
     }
     $formData->setMassiveAttr('visible', FALSE, $array_to_visible_false);
     $formData->setActive(array("value" => "1", "visible" => FALSE));
     //$this->my_redirect = "admin/page/select/";
     parent::edit($formData, TRUE, NULL, $this->my_redirect, NULL, $ReturnResultVO);
 }