Exemplo n.º 1
2
 public static function getMainMenu()
 {
     return ObjectDB::getAllOnField(self::$table, __CLASS__, "type", MAINMENU, "id");
 }
Exemplo n.º 2
1
 public function __construct()
 {
     parent::__construct(self::$table);
     $this->add("name", "ValidateTitle");
     $this->add("ind", "ValidateMD");
     $this->add("address", "ValidateMK");
     $this->add("phone", "ValidateIMG");
     $this->add("email", "ValidateEmail");
     $this->add("inn", "ValidateText");
     $this->add("kpp", "ValidateText");
     $this->add("bik", "ValidateText");
     $this->add("rs", "ValidateText");
     $this->add("bank", "ValidateText");
     $this->add("ks", "ValidateText");
     $this->add("okpo", "ValidateText");
     $this->add("okato", "ValidateText");
     $this->add("ogrn", "ValidateText");
 }
Exemplo n.º 3
0
 public function __construct()
 {
     parent::__construct(self::$table);
     $this->add("order_id", "ValidateID");
     $this->add("product_id", "ValidateID");
     $this->add("count", "ValidatePhone");
 }
Exemplo n.º 4
0
 public function __construct()
 {
     parent::__construct(self::$table);
     $this->add("login", "ValidateLogin");
     $this->add("email", "ValidateEmail");
     $this->add("password", "ValidatePassword");
 }
Exemplo n.º 5
0
 public function __construct()
 {
     parent::__construct(self::$table);
     $this->add("name`", "ValidateTitle");
     $this->add("post`", "ValidateTitle");
     $this->add("img", "ValidateIMG");
 }
Exemplo n.º 6
0
 public static function getImgOnID($id)
 {
     $select = new Select(self::$db);
     $select->from(self::$table, "*")->where("`product_id` = " . self::$db->getSQ(), array($id));
     $data = self::$db->select($select);
     $images = ObjectDB::buildMultiple(__CLASS__, $data);
     return $images;
 }
Exemplo n.º 7
0
 public function __construct()
 {
     parent::__construct(self::$table);
     $this->add("title", "ValidateTitle");
     $this->add("meta_desc", "ValidateMD");
     $this->add("meta_key", "ValidateMK");
     $this->add("full_text", "ValidateText");
 }
 public static function getAllOnArticleID($article_id)
 {
     $select = new Select(self::$db);
     $select->from(self::$table, "*")->where("`article_id` = " . self::$db->getSQ(), array($article_id))->order("date");
     $comments = ObjectDB::buildMultiple(__CLASS__, self::$db->select($select));
     $comments = ObjectDB::addSubObject($comments, "UserDB", "user", "user_id");
     return $comments;
 }
Exemplo n.º 9
0
 public function __construct()
 {
     parent::__construct(self::$table);
     $this->add("author", "ValidateTitle");
     //автор
     $this->add("text", "ValidateSmallText");
     //текст
 }
Exemplo n.º 10
0
 public static function getAdminShow()
 {
     $data = self::$db->getResult("select c.*, s.title as section from " . Config::DB_PREFIX . "category c left join " . Config::DB_PREFIX . "section s on c.section_id=s.id");
     $category = ObjectDB::buildMultiple(__CLASS__, $data);
     foreach ($category as $cat) {
         $cat->postAdminHandling();
     }
     return $category;
 }
Exemplo n.º 11
0
 public static function getStudentsOnGroupID($group_id)
 {
     $select = new Select(self::$db);
     $select->from(self::$table, "*")->where("`group_id` = ?", array($group_id));
     $data = self::$db->select($select);
     $students = ObjectDB::buildMultiple(__CLASS__, $data);
     //foreach ($groups as $g) $g->postHandling();
     return $students;
 }
Exemplo n.º 12
0
 public static function getAllOnArticleID($article_id)
 {
     $select = new Select(self::$db);
     $select->from(self::$table, "*")->where("`article_id` = " . self::$db->getSQ(), array($article_id))->order("date");
     //сортировка по дате
     $comments = ObjectDB::buildMultiple(__CLASS__, self::$db->select($select));
     $comments = ObjectDB::addSubObject($comments, "UserDB", "user", "user_id");
     //добавление к коментариям данных пользователя
     return $comments;
 }
 public function __construct()
 {
     parent::__construct(self::$table);
     $this->add("title", "ValidateTitle");
     $this->add("img", "ValidateIMG");
     $this->add("section_id", "ValidateID");
     $this->add("description", "ValidateText");
     $this->add("meta_desc", "ValidateMD");
     $this->add("meta_key", "ValidateMK");
 }
Exemplo n.º 14
0
 public function __construct()
 {
     parent::__construct(self::$table);
     $this->add("login", "ValidateLogin");
     $this->add("email", "ValidateEmail");
     $this->add("password", "ValidatePassword");
     $this->add("name", "ValidateName");
     $this->add("date_reg", "ValidateDate", self::TYPE_TIMESTAMP, $this->getDate());
     $this->add("activation", "ValidateActivation", null, $this->getKey());
 }
Exemplo n.º 15
0
 public static function getItems()
 {
     $select = new Select(self::$db);
     $select->from(self::$table, array("s.*", "p.img"), "s")->join("INNER", "product", "p", "s.product_id = p.id");
     $data = self::$db->select($select);
     $slider = ObjectDB::buildMultiple(__CLASS__, $data);
     foreach ($slider as $slide) {
         $slide->postHandling();
     }
     return $slider;
 }
Exemplo n.º 16
0
 public static function getItemsOnView($view)
 {
     $select = new Select(self::$db);
     $select->from(self::$table, "*")->where("`view_id` = ?", array($view));
     $data = self::$db->select($select);
     $items = ObjectDB::buildMultiple(__CLASS__, $data);
     foreach ($items as $item) {
         $item->postHandling();
     }
     return $items;
 }
Exemplo n.º 17
0
 public static function getGroupsOnTeacherID($id)
 {
     $select = new Select(self::$db);
     $select->from(self::$table, "*")->where("`teacher_id` = ?", array($id));
     $data = self::$db->select($select);
     $groups = ObjectDB::buildMultiple(__CLASS__, $data);
     foreach ($groups as $g) {
         $g->postHandling();
     }
     return $groups;
 }
Exemplo n.º 18
0
 public static function getItems()
 {
     if (isset($_SESSION["basket"])) {
         $items = ObjectDB::buildMultiple("ProductDB", $_SESSION["basket"]);
         foreach ($items as $item) {
             $item->img = Config::DIR_IMG_PRODUCT . $item->img;
         }
         return $items;
     }
     return false;
 }
Exemplo n.º 19
0
 public function __construct()
 {
     parent::__construct(self::$table);
     $this->add("title", "ValidateTitle");
     //заголовок
     $this->add("img", "ValidateIMG");
     //картинка
     $this->add("description", "ValidateText");
     //текст
     $this->add("meta_desc", "ValidateMD");
     //описание в метатегах
     $this->add("meta_key", "ValidateMK");
     //ключевые слова
 }
Exemplo n.º 20
0
 public function loadOnSectionID($section_id, $type)
 {
     $select = new Select();
     $select->from(self::$table, "*")->where("`type` = " . self::$db->getSQ(), array($type))->where("`latest` = " . self::$db->getSQ(), array(1))->rand();
     $data_1 = self::$db->select($select);
     $select = new Select();
     $select->from(self::$table, "*")->where("`type` = " . self::$db->getSQ(), array($type));
     if ($section_id) {
         $select->whereFIS("section_ids", $section_id);
     }
     $select->rand();
     $data_2 = self::$db->select($select);
     $data = array_merge($data_1, $data_2);
     if (count($data) == 0) {
         $select = new Select();
         $select->from(self::$table, "*")->where("`type` = " . self::$db->getSQ(), array($type))->rand();
         $data = self::$db->select($select);
     }
     $data = ObjectDB::buildMultiple(__CLASS__, $data);
     uasort($data, array(__CLASS__, "compare"));
     $first = array_shift($data);
     $this->load($first->id);
 }
Exemplo n.º 21
0
 public function __construct()
 {
     parent::__construct(self::$table);
     $this->add("title", "ValidateTitle");
     $this->add("checked", "ValidateBoolean");
 }
 public static function getCountOnPollDataID($poll_data_id)
 {
     return ObjectDB::getCountOnField(self::$table, "poll_data_id", $poll_data_id);
 }
Exemplo n.º 23
0
 public static function getAdminShow()
 {
     $data = self::$db->getResult("select p.id, p.title, p.img, p.video, c.title as category, b.title as brand, p.price, p.full_text, p.meta_desc, p.meta_key, p.available\r\n\t\t\tfrom " . Config::DB_PREFIX . "product p \r\n\t\t\tleft join " . Config::DB_PREFIX . "category c on p.category_id=c.id\r\n\t\t\tleft join " . Config::DB_PREFIX . "brand b on p.brand_id=b.id");
     $items = ObjectDB::buildMultiple(__CLASS__, $data);
     foreach ($items as $item) {
         $item->postAdminHandling();
     }
     return $items;
 }
Exemplo n.º 24
0
 public function __construct()
 {
     parent::__construct(self::$table);
     $this->add("link", "ValidateURI");
     $this->add("alias", "ValidateTitle");
 }
Exemplo n.º 25
0
 public function __construct()
 {
     parent::__construct(self::$table);
     $this->add("title", "ValidateTitle");
     $this->add("state", "ValidateBoolean", null, 0);
 }
Exemplo n.º 26
0
 protected static function searchObjects($select, $class, $fields, $words, $min_len)
 {
     $words = mb_strtolower($words);
     $words = preg_replace("/ {2,}/", " ", $words);
     if ($words == "") {
         return array();
     }
     $array_words = explode(" ", $words);
     $temp = array();
     foreach ($array_words as $value) {
         if (strlen($value) >= $min_len) {
             $temp[] = $value;
         }
     }
     $array_words = $temp;
     if (count($array_words) == 0) {
         return array();
     }
     foreach ($array_words as $value) {
         $where = "";
         $params = array();
         for ($i = 0; $i < count($fields); $i++) {
             $where .= "`" . $fields[$i] . "` LIKE " . self::$db->getSQ();
             $params[] = "%{$value}%";
             if ($i + 1 != count($fields)) {
                 $where .= "OR";
             }
         }
         $select->where("({$where})", $params, true);
     }
     $results = self::$db->select($select);
     if (!$results) {
         return array();
     }
     $results = ObjectDB::buildMultiple($class, $results);
     foreach ($results as $result) {
         for ($j = 0; $j < count($fields); $j++) {
             $result->{$fields}[$j] = mb_strtolower(strip_tags($result->{$fields}[$j]));
         }
         $data[$result->id] = $result;
         $data[$result->id]->relevant = self::getRelevantForSearch($result, $fields, $array_words);
     }
     uasort($data, array("AbstractObjectDB", "compareRelevant"));
     return $data;
 }
Exemplo n.º 27
0
 private function postHandling()
 {
     $this->setSectionAndCategory();
     //подгружаем разделы и категории
     $this->count_comments = CommentDB::getCountOnArticleID($this->id);
     //кол-во коментариев
     $this->day_show = ObjectDB::getDay($this->date);
     $this->month_show = ObjectDB::getMonth($this->date);
 }
Exemplo n.º 28
0
 public static function getAllOnPollID($poll_id)
 {
     return ObjectDB::getAllOnField(self::$table, __CLASS__, "poll_id", $poll_id, "id");
 }
Exemplo n.º 29
-1
 public function __construct()
 {
     parent::__construct(self::$table);
     $this->add("login", "ValidateLogin");
     //логин
     $this->add("email", "ValidateEmail");
     //почта
     $this->add("password", "ValidatePassword");
     //пароль
     $this->add("name", "ValidateName");
     //ФИО
     $this->add("avatar", "ValidateIMG");
     //аватарка
     $this->add("date_reg", "ValidateDate", self::TYPE_TIMESTAMP, $this->getDate());
     //дата регистрации
     $this->add("activation", "ValidateActivation", null, $this->getKey());
     //активироан ли пользователь
 }
Exemplo n.º 30
-3
 public function __construct()
 {
     parent::__construct(self::$table);
     $this->add("name", "ValidateTitle");
     $this->add("phone", "ValidatePhone");
     $this->add("email", "ValidateEmail");
     $this->add("address", "ValidateSmallText");
     $this->add("pay_id", "ValidateID");
     $this->add("delivery_id", "ValidateID");
     $this->add("summ", "ValidatePrice");
     $this->add("notice");
     $this->add("date_order", "ValidateDate", self::TYPE_TIMESTAMP, $this->getDate());
     $this->add("date_pay", "ValidateDate", self::TYPE_TIMESTAMP);
     $this->add("date_send", "ValidateDate", self::TYPE_TIMESTAMP);
 }