public function add() { //name $nome = DataHandler::getValueByArrayIndex($_POST, "nome"); //title $sobreNome = DataHandler::getValueByArrayIndex($_POST, "sobreNome"); //author $email = DataHandler::getValueByArrayIndex($_POST, "email"); //hat $companhia = DataHandler::getValueByArrayIndex($_POST, "companhia"); //slug $profissao = DataHandler::getValueByArrayIndex($_POST, "provissao"); //key_words $arquiteto = DataHandler::getValueByArrayIndex($_POST, "arquiteto"); $erros = array(); //validação if (!Validation::validateEmail($email)) { $erros[] = "email inválido"; } if (!$nome) { $erros[] = "nome inválido"; } if (!$sobreNome) { $erros[] = "sobrenome incorreto"; } $ReturnResultVO = new ReturnResultVO($erros); if (!count($erros) > 0) { //nao tem erros na validação $ContentSiteVO = new ContentSiteVO(); $ContentSiteVO->setName($nome); $ContentSiteVO->setTitle($sobreNome); $ContentSiteVO->setAuthor($email); $ContentSiteVO->setHat($companhia); $ContentSiteVO->setSlug($profissao); $ContentSiteVO->setKeyWords($arquiteto); $ReturnResultVO = $ContentSiteVO->commit(); if ($ReturnResultVO->success) { //agora poe esse content na categoria correta $CategoryVO = new CategoryVO(); echo "id de category necessária para newslatter funcionar"; exit; $CategoryVO->setId(127, TRUE); if ($ContentSiteVO->getId() > 0) { $CategoryVO->addLink("newslatter", $ContentSiteVO->getId()); $CategoryVO->commit(); } } } echo $ReturnResultVO->toJson(); exit; }
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); }
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); }
public function updateCourseCate(\CategoryVO $obj) { $config_properties = (require '../../model-db-connection/GoGetRighconf.properties.php'); // Create connection $mysqli = new mysqli($config_properties['domain'], $config_properties['username'], $config_properties['password'], $config_properties['databasename']); /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit; } $mysqli->set_charset("utf8"); // prepare and bind $stmt = $mysqli->prepare("UPDATE GTRICH_COURSE_CATEGORY SET CATE_NAME=?,CATE_CREATE_DATE_TIME=? WHERE CATE_ID=?"); $stmt->bind_param("sss", $obj->getCateName(), $obj->getCateDate(), $obj->getCateID()); if ($stmt->execute()) { return 200; } else { return "503 Internal Error:" . $stmt->error; } $stmt->close(); $mysqli->close(); }
public function parse($data) { $this->databaseData = $data; while ($row = mysql_fetch_array($this->databaseData)) { $object = new CategoryVO($row[0]); $object->title($row['title']); $object->description($row['description']); if ($row['isPrivate'] == 'true') { $object->isPrivate(true); } else { if ($row['isPrivate'] == 'false') { $object->isPrivate(false); } else { $object->isPrivate(true); } } array_push($this->parsedData, $object); } return array_reverse($this->parsedData); }
public function commit() { //iniciando o retorno padrao $HttpReturnResult = new HttpResult(); $CategoryVO = new CategoryVO(); if ($_POST["category_id"] == NULL) { $_POST["category_id"] = 0; } $_POST["active"] = 1; $CategoryVO->setFetchArray($_POST); $ResultValidate = $CategoryVO->validate(); $resultPage = new DefaultPage(); //Debug::print_r($ResultValidate); exit(); if ($ResultValidate->success) { $ReturnResult = $CategoryVO->commit(); //Debug::print_r($ReturnResult);exit(); if ($ReturnResult->success) { Navigation::redirect("admin/category/select"); } else { $resultPage->returnResult = $ReturnResult; } } else { $resultPage->returnResult = $ResultValidate; } $HttpReturnResult->setHttpContentResult($resultPage); return $HttpReturnResult; }
public function commit() { //iniciando o retorno padrao $HttpReturnResult = new HttpResult(); $CategoryVO = new CategoryVO(); if (!isset($_POST["category_id"]) || $_POST["category_id"] == NULL) { $_POST["category_id"] = 2; } $_POST["active"] = 1; $CategoryVO->setFetchArray($_POST); $id = DataHandler::forceInt(DataHandler::getValueByArrayIndex($this->arrayVariable, "id")); if ($id > 0) { $CategoryVO->setId($id); } $ResultValidate = $CategoryVO->validate(); $resultPage = new DefaultPage(); //Debug::print_r($ResultValidate); exit(); if ($ResultValidate->success) { $ReturnResult = $CategoryVO->commit(); //Debug::print_r($ReturnResult);exit(); if ($ReturnResult->success) { Navigation::redirect("backend/category/show"); } else { $resultPage->returnResult = $ReturnResult; } } else { $resultPage->returnResult = $ResultValidate; } $HttpReturnResult->setHttpContentResult($resultPage); return $HttpReturnResult; }
<?php /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ require '../../model/com.gogetrich.dao/CategoryDaoImpl.php'; require '../../model/com.gogetrich.service/CategoryService.php'; require '../../model/com.gogetrich.model/CategoryVO.php'; $cateDao = new CategoryDaoImpl(); $cateService = new CategoryService($cateDao); $cateName = $_GET['cateName']; $cateVO = new CategoryVO(); $cateVO->setCateID(md5(date("h:i:sa"))); $cateVO->setCateName($cateName); echo $cateService->saveCourseCategory($cateVO);
private function getCategoryCascade($dad_category_id) { $CategoryVO = new CategoryVO(); $CategoryVO->setId($dad_category_id, TRUE); return $CategoryVO->selectCascade(CategoryDAO::RETURN_STD_OBJECT, 1); }
/** * @param (object) $obj_dados * @return void */ function setFetchObject($obj_dados) { $this->setDescription(DataHandler::getValueByStdObjectIndex($obj_dados, "description")); parent::setFetchObject($obj_dados); }
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); }
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 ""; }
<?php /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ require '../../model/com.gogetrich.dao/CategoryDaoImpl.php'; require '../../model/com.gogetrich.service/CategoryService.php'; require '../../model/com.gogetrich.model/CategoryVO.php'; $cateDao = new CategoryDaoImpl(); $cateService = new CategoryService($cateDao); $cateName = $_GET['cateName']; $cateVO = new CategoryVO(); $cateVO->setCateID($_GET['cateID']); $cateVO->setCateName($cateName); $cateVO->setCateDate($_GET['cateDate']); echo $cateService->updateCourseCate($cateVO);