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}/"; } $formData = new ContentFormView($this->ContentSiteVO, Config::getRootPath($this->my_action)); $ImageFormView = new ImageFormView(); $ImageFormView->setFormLabel("Selecionar Imagem"); $ImageFormView->setQuantity(0); // $ImageFormView->setDescription(array('label'=>Translation::text('Link'), 'visible'=>false, 'type'=>'simpleText')); $FileFormView = new FileFormView(); $FileFormView->setFormLabel("Selecionar Arquivo"); $FileFormView->setQuantity(0); // $formData->setPersonalInput(array("name"=>"destaque[]","label"=>"Mostrar na Home?", "options"=>array((object) array("name"=>"Palestrantes", "id"=>"33"), (object) array("name"=>"Outros Palestrantes", "id"=>"34")))); //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" => "Url:")); $formData->setCategory(array("visible" => FALSE, "name" => "category[]", "selected" => array($this->category_id))); $formData->setImage($ImageFormView); $formData->setFile($FileFormView); $formData->setMassiveAttr('visible', FALSE, array('Name', 'Description', 'Content', 'Author', 'TemplateUrl', 'Slug', 'KeyWords', 'Date', 'DateIn', 'DateOut')); $formData->setActive(array("value" => "1", "visible" => FALSE)); $this->my_redirect = "admin/menu_top/select/"; parent::edit($formData, TRUE, NULL, $this->my_redirect, NULL, $ReturnResultVO); }
public function edit() { //busca o primeiro content vinculada com essa categoria if ($this->category_id > 0) { $CategoryVO = new CategoryVO(); $CategoryVO->setId($this->category_id, TRUE); $array_content = $CategoryVO->getLinks("content", 1); //se tiver mais de um link if (count($array_content) > 0) { //pega o primeiro pois aqui só importa 1. $LinkVO = $array_content[0]; if (FALSE) { //ajuda aptana $LinkVO = new LinkVO(); } //echo Debug::li("tem content vinculada com id:".$LinkVO->getLinkedTableId()); //inicia a ContentEncVO $this->ContentEncVO->setId($LinkVO->getLinkedTableId(), TRUE); } } //criar o formView $formData = new ContentFormView($this->ContentEncVO, Config::getRootPath($this->my_action)); //trocando o rótulo para Content $formData->setContent(array("label" => "Edite o texto:")); $ImageFormView = new ImageFormView(); $ImageFormView->setFormLabel("Inserir Imagem"); //quando ta em outro idioma que não o padrao, não pode ter imagem $ImageFormView->setQuantity(0); $FileFormView = new FileFormView(); $FileFormView->setFormLabel("Inserir Arquivo"); $FileFormView->setQuantity(0); if ($this->ContentEncVO->getId() > 0) { //se tiver id significa que o content já foi adicionado alguma vez, então deixa queto } else { //seta o id dessa categoria caso não tenha nenhum content vinculado, pois essa categoria só admite 1 content $formData->setCategory(array("selected" => array($this->category_id))); } $formData->setImage($ImageFormView); $formData->setFile($FileFormView); $formData->setMassiveAttr('visible', FALSE, array('Name', 'Title', 'Hat', 'Description', 'Author', 'TemplateUrl', 'Slug', 'KeyWords', 'Date', 'DateIn', 'DateOut', 'Order')); $formData->setSlug(array("value" => "entre_em_contato", "visible" => FALSE)); $formData->setActive(array("value" => "1", "visible" => FALSE)); parent::edit($formData, TRUE, NULL, $this->my_redirect); }
private function createFormData($ReturnResultVO = NULL) { //busca o primeiro content vinculada com essa categoria if ($this->category_id > 0) { $CategoryVO = new CategoryVO(); $CategoryVO->setId($this->category_id, TRUE); $array_content = $CategoryVO->getLinks("content", 1); //se tiver mais de um link if (count($array_content) > 0) { //pega o primeiro pois aqui só importa 1. $LinkVO = $array_content[0]; if (FALSE) { //ajuda aptana $LinkVO = new LinkVO(); } //echo Debug::li("tem content vinculada com id:".$LinkVO->getLinkedTableId()); //inicia a ContentForumVO $this->ContentSiteVO->setId($LinkVO->getLinkedTableId(), TRUE); } } else { if ($this->content_id > 0) { $this->my_action .= "/id.{$this->content_id}/"; } } $formData = new ContentFormView($this->ContentSiteVO, Config::getRootPath($this->my_action)); $ImageFormView = new ImageFormView(); $ImageFormView->setFormLabel("Selecionar Foto"); $ImageFormView->setQuantity(0); // $ImageFormView->setDescription(array('label'=>Translation::text('Link'), 'visible'=>false, 'type'=>'simpleText')); $FileFormView = new FileFormView(); $FileFormView->setFormLabel("Selecionar Arquivo"); $FileFormView->setQuantity(0); // $formData->setPersonalInput(array("name"=>"destaque[]","label"=>"Mostrar em qual Menu?", "options"=>array((object) array("name"=>"Menu Topo", "id"=>"2"), (object) array("name"=>"Menu Rodapé", "id"=>"3")))); //trocando o rótulo para Content $formData->setDescription(array("label" => "Edite a coluna da Esquerda:", 'type' => 'htmlText')); $formData->setContent(array("label" => "Edite a coluna da Direita:")); $formData->setCategory(array("visible" => FALSE, "name" => "category[]", "selected" => array($this->category_id))); $formData->setImage($ImageFormView); $formData->setFile($FileFormView); $formData->setMassiveAttr('visible', FALSE, array('Name', 'Title', 'Hat', 'Author', 'TemplateUrl', 'Slug', 'KeyWords', 'Date', 'DateIn', 'DateOut', 'Order')); $formData->setActive(array("value" => "1", "visible" => FALSE)); $this->my_redirect = "admin/contact/edit/"; parent::edit($formData, TRUE, NULL, $this->my_redirect, NULL, $ReturnResultVO); }
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); }
/** * @param $_ContentFormView ContentFormView * @param $direct_show_view Boolean default TRUE * @param $form_action String do action no form * @param $redirect_to String do redirect to depois do commit * @param $arrayFields array de fields * @param $p_ReturnResultVO opicional parametro para retorno de mensagem de erro ou sucesso * @return void or HttpResult */ public function edit($_ContentFormView = NULL, $direct_show_view = TRUE, $form_action = NULL, $redirect_to = NULL, $arrayFields = NULL, $p_ReturnResultVO = NULL) { if ($_ContentFormView) { $formData = $_ContentFormView; } else { if (FALSE) { $this->ContentSiteVO = new $ContentSiteVO(); } //se for enviado o content_id por parametro, usa ele como id if ($this->content_id > 0) { $this->ContentSiteVO->setId($this->content_id, TRUE); } $action_path = Config::getRootPath('admin/content/commit'); //se for enviado o $form_action, então utiliza o que foi enviado if ($form_action) { $action_path = Config::getRootPath($form_action); } $formData = new ContentFormView($this->ContentSiteVO, $action_path); } //$formData->setModules(); $HttpResult = new HttpResult(); $HttpResult->setSuccess(1); //iniciando o resultado para o html $retornoDaPaginaHTML = new HttpRoot(); $retornoDaPaginaHTML->arrayVariable->form_data = $formData->getFormData(); if ($redirect_to != NULL) { $retornoDaPaginaHTML->arrayVariable->form_data->fields->redirect_to = (object) array("name" => "redirect_to", "value" => $redirect_to, "visible" => false); } if ($arrayFields != NULL) { //passou array de fields para adicionar //adiciona foreach ($arrayFields as $field_item) { $retornoDaPaginaHTML->arrayVariable->form_data->fields[] = $field_item; } } //$redirect_to = NULL //buscando imagens vinculadas $array_image_vo = $this->ContentSiteVO->getImages(); $array_image_std = array(); foreach ($array_image_vo as $VO) { $StdVO = $VO->toStdClass(); $array_image_std[] = $StdVO; } $retornoDaPaginaHTML->arrayVariable->array_image = $array_image_std; //se for enviado o ReturnResultVO no parametro, adiciona como atributo if ($p_ReturnResultVO) { // print_r($p_ReturnResultVO);exit(); $retornoDaPaginaHTML->return_result_vo = $p_ReturnResultVO; } //buscando arquivos vinculadas $array_file_vo = $this->ContentSiteVO->getFiles(); $array_file_std = array(); foreach ($array_file_vo as $VO) { $StdVO = $VO->toStdClass(); $array_file_std[] = $StdVO; } $retornoDaPaginaHTML->arrayVariable->array_file = $array_file_std; //salvando o objeto de resultado de html no retorno $HttpResult->setHttpContentResult($retornoDaPaginaHTML); //se for passado como true vai usar o layout abaixo. if ($direct_show_view) { include Config::getFolderView($this->my_edit_page); exit; } return $HttpResult; }