Example #1
0
 public function getMore()
 {
     $this->language->load('studio/template');
     $this->data['template_text_empty'] = $this->language->get('template_text_empty');
     $this->data['template_text_show_more'] = $this->language->get('template_text_show_more');
     $filters['sort'] = "RAND()";
     $filters['order'] = "ASC";
     $filters['filter_id_author'] = 0;
     $filters['filter_status'] = 1;
     //keyword
     if (!empty($this->request->request['template_keyword'])) {
         $filters['filter_keyword'] = $this->request->request['template_keyword'];
         $filters['sort'] = "c.date_added";
     }
     //category
     $categories = array();
     if (!empty($this->request->request['template_category'])) {
         $filters['filter_id_category'] = $this->request->request['template_category'];
         $filters['sort'] = "c.date_added";
     }
     $this->load->model('opentshirts/composition');
     $templates = array();
     ///get all template matching filters for pagination with no limits
     $total = $this->model_opentshirts_composition->getTotalCompositions($filters);
     $template_page = 1;
     if (isset($this->request->request['template_page'])) {
         $template_page = $this->request->request['template_page'];
     }
     $this->data['template_page'] = $template_page;
     $pagination = new Pagination();
     $pagination->total = $total;
     $pagination->page = $template_page;
     $pagination->limit = 10;
     $filters['start'] = $pagination->getStart();
     $filters['limit'] = $pagination->limit;
     $results = $this->model_opentshirts_composition->getCompositions($filters);
     $this->load->model('opentshirts/design');
     $this->load->model('tool/image');
     $this->data['templates'] = array();
     foreach ($results as $result) {
         $design_results = $this->model_opentshirts_design->getDesigns(array("filter_id_composition" => $result['id_composition']));
         foreach ($design_results as $design_result) {
             if (file_exists(DIR_IMAGE . 'data/designs/design_' . $design_result['id_design'] . '/snapshot.png')) {
                 $image = $this->model_tool_image->resize('data/designs/design_' . $design_result['id_design'] . '/snapshot.png', 140, 140);
             } else {
                 $image = $this->model_tool_image->resize('no_image.jpg', 140, 140);
             }
             $this->data['templates'][] = array('id_template' => $design_result['id_design'], 'name' => $result['name'], 'image' => $image);
         }
     }
     $this->data['show_more'] = (bool) ($pagination->getEnd() < $pagination->getTotal());
     if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/studio/more_template.tpl')) {
         $this->template = $this->config->get('config_template') . '/template/studio/more_template.tpl';
     } else {
         $this->template = 'default/template/studio/more_template.tpl';
     }
     $this->response->setOutput($this->render());
 }
Example #2
0
 /**
  * Shows the pillory.
  *
  * @return Bengine_Comm_Controller_Pillory
  */
 public function indexAction()
 {
     Core::getTPL()->clearHTMLHeaderFiles();
     Core::getTPL()->addHTMLHeaderFile("game.css", "css");
     Core::getTPL()->addHTMLHeaderFile("lib/jquery.js", "js");
     $result = Core::getQuery()->select("ban_u", array("banid"));
     $pagination = new Pagination(Core::getConfig()->get("PILLORY_ITEMS_PER_PAGE"), $result->rowCount());
     $pagination->setConfig("page_url", Core::getLang()->getOpt("langcode") . "/pillory/index/%d")->setConfig("main_element_class", "pagination center-table")->setMaxPagesToShow(Core::getConfig()->get("MAX_PILLORY_PAGES"))->setCurrentPage($this->getParam("1"))->setConfig("base_url", Core::getLang()->getOpt("langcode") . "/pillory");
     Core::getTPL()->addLoop("bans", $this->getBans($pagination->getStart(), Core::getConfig()->get("PILLORY_ITEMS_PER_PAGE")));
     $this->assign("pagination", $pagination);
     return $this;
 }