Esempio n. 1
0
 public static function FetchAll()
 {
     global $db_connection;
     $res = array();
     $from_table = Direction::$table;
     $lang = GetLanguage();
     if ($lang != 'rus') {
         $from_table .= '_' . $lang;
     }
     $result = $db_connection->query("SELECT * FROM `" . $from_table . "` ORDER BY id DESC");
     if (!$result) {
         return NULL;
     }
     while ($row = $result->fetch_assoc()) {
         $row['language'] = $lang;
         array_push($res, Direction::FetchFromAssoc($row));
     }
     return $res;
 }
Esempio n. 2
0
     }
     if (Error::IsError($ob)) {
         $content = AlertMessage('alert-danger', Language::Word('error while report sending'));
     } else {
         if (Report::InsertToDB($ob)) {
             $content = AlertMessage('alert-success', Language::Word('report is successfully sended'));
         } else {
             $content = AlertMessage('alert-danger', Language::Word('error while report inserting'));
         }
     }
     break;
 case Direction::$type:
     $assoc = $_POST;
     $assoc['author_id'] = $_POST['id'];
     unset($assoc['id']);
     $direction = Direction::FetchFromAssoc($assoc);
     if ($direction === NULL) {
         $content = AlertMessage('alert-danger', Language::Word('error during direction adding'));
     } else {
         $glob_id = 0;
         if (isset($_POST['glob_id'])) {
             $glob_id = $_POST['glob_id'];
         }
         if (Direction::InsertToDB($direction, $_POST['language'], $glob_id)) {
             $content = AlertMessage('alert-success', Language::Word('direction is successfully added'));
         } else {
             $content = AlertMessage('alert-danger', Language::Word('error during direction inserting'));
         }
     }
     break;
 case Project::$type: