public static function getMainMenu() { return ObjectDB::getAllOnField(self::$table, __CLASS__, "type", MAINMENU, "id"); }
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"); }
public function __construct() { parent::__construct(self::$table); $this->add("order_id", "ValidateID"); $this->add("product_id", "ValidateID"); $this->add("count", "ValidatePhone"); }
public function __construct() { parent::__construct(self::$table); $this->add("login", "ValidateLogin"); $this->add("email", "ValidateEmail"); $this->add("password", "ValidatePassword"); }
public function __construct() { parent::__construct(self::$table); $this->add("name`", "ValidateTitle"); $this->add("post`", "ValidateTitle"); $this->add("img", "ValidateIMG"); }
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; }
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; }
public function __construct() { parent::__construct(self::$table); $this->add("author", "ValidateTitle"); //автор $this->add("text", "ValidateSmallText"); //текст }
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; }
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; }
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"); }
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()); }
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; }
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; }
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; }
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; }
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"); //ключевые слова }
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); }
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); }
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; }
public function __construct() { parent::__construct(self::$table); $this->add("link", "ValidateURI"); $this->add("alias", "ValidateTitle"); }
public function __construct() { parent::__construct(self::$table); $this->add("title", "ValidateTitle"); $this->add("state", "ValidateBoolean", null, 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; }
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); }
public static function getAllOnPollID($poll_id) { return ObjectDB::getAllOnField(self::$table, __CLASS__, "poll_id", $poll_id, "id"); }
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()); //активироан ли пользователь }
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); }