Exemplo n.º 1
0
 /**
  * отображаем весь список материалов
  */
 function indexAction()
 {
     if ($_POST) {
         // даты
         if ($_POST['date_s'] != '') {
             $_POST['date_s'] = general::date_to_database($_POST['date_s']);
         }
         if ($_POST['date_po'] != '') {
             $_POST['date_po'] = general::date_to_database($_POST['date_po']);
         }
     }
     // строим запрос
     $_sql = "SELECT order_number.*, sum(orders.cost*orders.kolvo) as cost\n\t\t\t\tFROM order_number\n\t\t\t\tLeft Outer Join orders ON order_number.id =orders.number_order\n\t\t\t\tWHERE order_number.id>0 " . general::get_status_for_filter('order_number') . "\t\t\t\t\n\t\t\t\tGROUP BY order_number.id\n\t\t\t\tORDER BY order_number.id DESC";
     // выполняем запрос + при необходимости выводим сам запрос
     $result = mysql::query($_sql, 0);
     // массив типов
     global $_status_order;
     return system::show_tpl(array('result' => $result, 'msg' => $this->msg, 'status_order' => $_status_order, 'status_orders' => isset($_POST['status_orders']) ? $_POST['status_orders'] : 3), 'orders/index.php');
 }
Exemplo n.º 2
0
 /**
  * добавляем новый материал
  */
 function addAction()
 {
     if ($_POST) {
         // даты
         $_POST['FORM']['date_news'] = general::date_to_database($_POST['FORM']['date_news']);
         $this->_width = mysql::query_findpole('select zna from config where id=16', 'zna');
         $this->_height = mysql::query_findpole('select zna from config where id=17', 'zna');
         $this->_width_b = mysql::query_findpole('select zna from config where id=19', 'zna');
         $this->_height_b = mysql::query_findpole('select zna from config where id=20', 'zna');
         // проверяем на checkbox
         forms::check_box(array('status'));
         // проверяем на существование такого action, если есть - добавляем несколько символов
         $_sql = 'SELECT count(*) as count FROM ' . $this->tablename . ' where url="' . $_POST['FORM']['url'] . '"';
         // выполняем запрос + при необходимости выводим сам запрос
         if (mysql::query_findpole($_sql, 'count', 0) > 0) {
             $_POST['FORM']['url'] .= '_new';
         }
         // записываем в базу
         forms::multy_insert_form($this->tablename, 0);
         $this->msg = general::messages(1, v::getI18n('backend_after_save'));
         // загружаем фото
         forms::multy_update_photo(HOST . IMG_NEWS_PATH, 1, mysql_insert_id(), $this->_width, $this->_height, $this->_width_b, $this->_height_b);
     }
     // массив типов
     global $_type_news;
     return system::show_tpl(array('msg' => $this->msg, 'select' => $_type_news, 'tpl_folder' => $this->tpl_folder), $this->tpl_folder . '/add.php');
 }