Exemplo n.º 1
0
 public function commit()
 {
     //				echo "cococ";exit();
     $this->redirect_with_id = FALSE;
     if (DataHandler::getValueByArrayIndex($_POST, "destaque")) {
         if (is_array($_POST["category"])) {
             $_POST["category"] = DataHandler::appendArray($_POST["category"], $_POST["destaque"]);
         } else {
             throw new Exception("envie a array de categoria. Sem isso a content nao funciona.");
         }
     }
     parent::commit();
 }
Exemplo n.º 2
0
 public function commit($redirect_page = TRUE, $gallery_type = "image")
 {
     //iniciando o retorno padrao
     $_POST["active"] = 1;
     if (!isset($_POST["category"]) || $_POST["category"] == NULL) {
         $_POST["category"] = array($this->category_id);
     } else {
         if (!is_array($_POST["category"])) {
             $_POST["category"] = array($_POST["category"], $this->category_id);
         } else {
             //é uma array, mas melhor garantir que tem o produto id
             $_POST["category"][] = $this->category_id;
         }
     }
     if (isset($_POST["hat"])) {
         $hat = $_POST["hat"];
         //tira o vinculo com a tabela ano (que nao existe)
         if ($content_id) {
             //adiciona o vinculo com a tabela ano de indice hat
             $LinkDAO = LinkDAO::getInstance();
         }
         //deleta vinculos com categoria
         $LinkDAO->deleteAllFromLinkedTableByTableAndTableId('content', $content_id, 'ano');
         $LinkDAO->insert('ano', $hat, 'content', $content_id, 1, 0);
     }
     if (isset($_POST["title"])) {
         $_POST["slug"] = DataHandler::strToURL($_POST["title"]);
     }
     if (!isset($_POST["id"]) && DataHandler::getValueByArrayIndex($this->arrayVariable, "id")) {
         $_POST["id"] = DataHandler::getValueByArrayIndex($this->arrayVariable, "id");
     }
     if (!isset($_POST["order"])) {
         $_POST["order"] = NULL;
     }
     $return = parent::commit(FALSE, $gallery_type);
     $this->updatePdf($return->id);
     if ($redirect_page) {
         //Navigation::redirect($this->my_redirect);
         Navigation::redirect("backend/client/change/id." . $return->id);
         exit;
     }
     return $return;
 }
Exemplo n.º 3
0
 public function commit()
 {
     if (DataHandler::getValueByArrayIndex($_POST, "title") != NULL) {
         $slug = DataHandler::removeAccent(DataHandler::getValueByArrayIndex($_POST, "title"));
         $slug = DataHandler::removeSpecialCharacters($slug);
         $slug = strtolower($slug);
         $_POST["slug"] = $slug;
     }
     if (DataHandler::getValueByArrayIndex($_POST, "date") !== NULL && $_POST["date"] == "") {
         $_POST["date"] = "now()";
     }
     if ($this->sub == "unidades") {
         $_POST["content"] = "unidades";
     }
     //Debug::print_r($_POST);
     //exit();
     //echo Debug::li($this->my_redirect);exit();
     $this->redirect_with_id = FALSE;
     if (DataHandler::getValueByArrayIndex($_POST, "category")) {
         if (is_array($_POST["category"])) {
             //$_POST["category"] = $_POST["category"];
             if ($this->sub == "blog") {
                 $_POST["category"][] = 36;
             }
             //echo Debug::print_r($_POST["category"]);
             //exit();
         } else {
             throw new Exception("envie a array de categoria. Sem isso a content nao funciona.");
         }
     }
     parent::commit();
 }
Exemplo n.º 4
0
 public function commit($redirect_page = TRUE, $gallery_type = "image")
 {
     //iniciando o retorno padrao
     $_POST["active"] = 1;
     if (!isset($_POST["category"]) || $_POST["category"] == NULL) {
         $_POST["category"] = array($this->category_id);
     } else {
         if (!is_array($_POST["category"])) {
             $_POST["category"] = array($_POST["category"], $this->category_id);
         } else {
             //é uma array, mas melhor garantir que tem o produto id
             $_POST["category"][] = $this->category_id;
         }
     }
     if (isset($_POST["title"])) {
         $_POST["slug"] = DataHandler::strToURL($_POST["title"]);
     }
     if (!isset($_POST["id"]) && DataHandler::getValueByArrayIndex($this->arrayVariable, "id")) {
         $_POST["id"] = DataHandler::getValueByArrayIndex($this->arrayVariable, "id");
     }
     if (!isset($_POST["order"])) {
         $_POST["order"] = NULL;
     }
     if (!isset($_POST["hat"])) {
         $_POST["hat"] = "nao";
     }
     if (!isset($_POST["author"])) {
         $_POST["author"] = "nao";
     }
     return parent::commit($redirect_page, $gallery_type);
 }
Exemplo n.º 5
0
 public function commit($redirect_page = TRUE, $gallery_type = "image")
 {
     //iniciando o retorno padrao
     //$_POST["active"] = 1;
     if (!isset($_POST["category"]) || $_POST["category"] == NULL) {
         $_POST["category"] = array($this->category_id);
     } else {
         if (!is_array($_POST["category"])) {
             $_POST["category"] = array($_POST["category"], $this->category_id);
         } else {
             //é uma array, mas melhor garantir que tem o produto id
             $_POST["category"][] = $this->category_id;
         }
     }
     if (isset($_POST["title"])) {
         $_POST["slug"] = DataHandler::strToURL($_POST["title"]);
     }
     if (!isset($_POST["id"]) && DataHandler::getValueByArrayIndex($this->arrayVariable, "id")) {
         $_POST["id"] = DataHandler::getValueByArrayIndex($this->arrayVariable, "id");
     }
     if (!isset($_POST["order"])) {
         $_POST["order"] = NULL;
     }
     if (!isset($_POST["hat"])) {
         $_POST["hat"] = "nao";
     }
     if (isset($_POST["nao_e_produto"])) {
         $_POST["active"] = 2;
     }
     if (!isset($_POST["author"])) {
         $_POST["author"] = "nao";
     }
     // Debug::print_r($_POST);exit();
     $return = parent::commit(FALSE, $gallery_type);
     $this->updatePdf($return->id);
     if ($redirect_page) {
         //Navigation::redirect($this->my_redirect);
         Navigation::redirect("backend/product/change/id." . $return->id);
         exit;
     }
     return $return;
 }