Example #1
0
 function _save()
 {
     $ID = isset($_GET['ID']) && $_GET['ID'] ? $_GET['ID'] : "";
     if (in_array($ID, array("undefined"))) {
         $ID = "";
     }
     //test_array($_POST);
     $values = array("category" => $this->post("category", "Required"), "text" => $this->post("text"), "photo" => $this->post("photo"), "relationship" => is_array($this->post("relationship")) ? implode(",", $this->post("relationship")) : "");
     $errors = $this->errors;
     //test_array($values);
     $result = array();
     $result['errors'] = $errors;
     $result['data'] = array();
     if (!count($errors)) {
         $result['data'] = array("ID" => models\categories::save($ID, $values));
     }
     return $GLOBALS["output"]['data'] = $result;
 }