Esempio n. 1
0
 /**
  * Configure widget settings
  * @param string $action
  * @param array $widget_data
  */
 public function show_form_configure($action = 'show_settings', array $widget_data = [])
 {
     if ($this->dx_auth->is_admin() == FALSE) {
         exit;
     }
     switch ($action) {
         case 'show_settings':
             assetManager::create()->setData('widget', $widget_data)->setData('forms', $this->xforms_model->get_forms())->renderAdmin('widget_settings');
             break;
         case 'update_settings':
             $this->form_validation->set_rules('form_id', 'Форма', 'required');
             if ($this->form_validation->run($this) == FALSE) {
                 showMessage(validation_errors(), false, 'r');
             } else {
                 $data = ['form_id' => $this->input->post('form_id')];
                 $this->load->module('admin/widgets_manager')->update_config($widget_data['id'], $data);
                 showMessage(lang('amt_settings_saved', 'xforms'));
                 if ($this->input->post('action') == 'tomain') {
                     pjax('/admin/widgets_manager/index');
                 }
             }
             break;
         case 'install_defaults':
             $this->load->module('admin/widgets_manager')->update_config($widget_data['id'], $this->defaults);
             break;
     }
 }
Esempio n. 2
0
 /**
  * Init 
  */
 private function init()
 {
     \CMSFactory\assetManager::create()->registerScript('scripts');
     $this->load->model('found_less_expensive_model');
     $lang = new MY_Lang();
     $lang->load('found_less_expensive');
 }
 /**
  * Render banner into template
  * @access public
  * @param int $id is id entity (brand, category, product, page) .... for main id = 0
  * @param string $group
  * @return boolean
  * @author L.Andriy <*****@*****.**>
  * @copyright (c) 2013, ImageCMS
  */
 public function render($id = 0, $group = 0)
 {
     if ($this->no_install === false) {
         return false;
     }
     $type = $this->core->core_data['data_type'];
     $lang = $this->get_main_lang('identif');
     $painting = $type . '_' . (int) $id;
     $hash = 'baners' . $type . $id . \CI_Controller::get_instance()->config->item('template');
     if ($cache = Cache_html::get_html($hash)) {
         \CMSFactory\assetManager::create()->registerScript('jquery.cycle.all.min');
         echo $cache;
     } else {
         $banners = $this->banner_model->get_all_banner($lang, $group);
         foreach ($banners as $banner) {
             $data = unserialize($banner['where_show']);
             if ((in_array($painting, $data) || in_array($type . '_0', $data)) && $banner['active'] && (time() < $banner['active_to'] or $banner['active_to'] == '-1')) {
                 $ban[] = $banner;
             }
         }
         if (count($ban) > 0) {
             $tpl = $this->banner_model->get_settings_tpl() ? $type . '_slider' : 'slider';
             ob_start();
             \CMSFactory\assetManager::create()->registerStyle('style')->registerScript('jquery.cycle.all.min')->setData(array('banners' => $ban))->render($tpl, TRUE);
             $baners_view = ob_get_clean();
             Cache_html::set_html($baners_view, $hash);
             echo $baners_view;
         } else {
             return FALSE;
         }
     }
 }
Esempio n. 4
0
 /**
  * Get settings from DB and display settings page
  * @author A.Gula <*****@*****.**>
  * @copyright (c) 2013, ImageCMS
  */
 public function index()
 {
     /** Get Settings from DB */
     $settings = $this->db->select('settings')->where('identif', 'socauth')->get('components')->row_array();
     /** Show template file */
     \CMSFactory\assetManager::create()->setData('settings', unserialize($settings[settings]))->renderAdmin('settings');
 }
 public function index()
 {
     $get_settings = $this->rating_model->get_settings();
     $settings = json_decode($get_settings['settings']);
     $this->template->add_array(array('settings' => $settings, 'is_shop' => $this->rating_model->is_shop()));
     \CMSFactory\assetManager::create()->renderAdmin('settings');
     //        $this->render('settings');
 }
Esempio n. 6
0
 public function index()
 {
     $settings = $this->db->get('mod_convead')->result();
     foreach ($settings as $item) {
         $data[$item->name] = $item->value;
     }
     \CMSFactory\assetManager::create()->setData($data)->renderAdmin('settings');
 }
Esempio n. 7
0
 public function index($offset = 0, $orderField = '', $orderCriteria = '')
 {
     $model = SCallbacksQuery::create()->joinSCallbackStatuses(null, 'left join')->joinSCallbackThemes(null, 'left join');
     if ($this->input->get('filterID') && $this->input->get('filterID') > 0) {
         $model = $model->filterById((int) $this->input->get('filterID'));
     }
     if ($this->input->get('user_name')) {
         $user_name = $this->input->get('user_name');
         if (!strpos($user_name, '%')) {
             $user_name = '%' . $user_name . '%';
         }
         $model->condition('name', 'SCallbacks.Name LIKE ?', $user_name);
         $model->where(array('name'), Criteria::LOGICAL_OR);
     }
     if ($this->input->get('phone')) {
         $phone = $this->input->get('phone');
         if (!strpos($phone, '%')) {
             $phone = '%' . $phone . '%';
         }
         $model->condition('phone', 'SCallbacks.Phone LIKE ?', $phone);
         $model->where(array('phone'), Criteria::LOGICAL_OR);
     }
     if ($this->input->get('ThemeId')) {
         if ((int) $this->input->get('ThemeId') > 0) {
             $model = $model->filterByThemeId((int) $this->input->get('ThemeId'));
         }
         if ($this->input->get('ThemeId') === 'without') {
             $model = $model->where('SCallbacks.ThemeId = ?', 0);
         }
     }
     if ($this->input->get('StatusId') && $this->input->get('StatusId') > 0) {
         $model = $model->filterByStatusId((int) $this->input->get('StatusId'));
     }
     if ($this->input->get('created_from')) {
         $model = $model->where('FROM_UNIXTIME(SCallbacks.Date, \'%Y-%m-%d\') >= ?', date('Y-m-d', strtotime($this->input->get('created_from'))));
     }
     if ($this->input->get('created_to')) {
         $model = $model->where('FROM_UNIXTIME(SCallbacks.Date, \'%Y-%m-%d\') <= ?', date('Y-m-d', strtotime($this->input->get('created_to'))));
     }
     if ($orderField !== '' && $orderCriteria !== '' && (method_exists($model, 'filterBy' . $orderField) || $orderField == 'SCallbackStatuses.Text' || $orderField == 'SCallbackThemes.Text')) {
         switch ($orderCriteria) {
             case 'ASC':
                 $model = $model->orderBy($orderField, Criteria::ASC);
                 $nextOrderCriteria = 'DESC';
                 break;
             case 'DESC':
                 $model = $model->orderBy($orderField, Criteria::DESC);
                 $nextOrderCriteria = 'ASC';
                 break;
         }
     } else {
         $model->orderById(Criteria::DESC);
     }
     $totalCallbacks = $this->_count($model);
     $model = $model->limit(10)->offset((int) $offset)->find();
     $callbackStatuses = SCallbackStatusesQuery::create()->joinWithI18n(MY_Controller::defaultLocale(), Criteria::RIGHT_JOIN)->where('SCallbackStatusesI18n.Locale = "' . MY_Controller::defaultLocale() . '"')->orderBy('IsDefault', Criteria::DESC)->orderById()->find();
     \CMSFactory\assetManager::create()->setData(array('model' => $model, 'totalCallbacks' => $totalCallbacks, 'nextOrderCriteria' => $nextOrderCriteria, 'orderField' => $orderField, 'callbackStatuses' => $callbackStatuses))->render('main');
 }
Esempio n. 8
0
 /**
  * Print Page
  * @param int $id
  */
 public function print_page($id)
 {
     if (!$this->no_install) {
         return false;
     }
     $page = get_page($id);
     \CMSFactory\assetManager::create()->registerStyleWithoutTemplate('style');
     \CMSFactory\assetManager::create()->setData(array('page' => $page))->render('print_page', TRUE);
 }
Esempio n. 9
0
 public function index()
 {
     /** Для начала соберем уже сохраненную информацию з таблицы */
     $settings = $this->db->get('mod_sample_settings')->result();
     /** И соберем её в массив для передачи у вид (шаблон) */
     foreach ($settings as $item) {
         $data[$item->name] = $item->value;
     }
     /** Класс для управления шаблоном */
     \CMSFactory\assetManager::create()->setData($data)->renderAdmin('settings');
 }
Esempio n. 10
0
 public function set_price($priceRange = null)
 {
     if (null === $priceRange) {
         $priceRange = \ShopCore::app()->SFilter->getPricerange();
     }
     $minPrice = (int) $priceRange['minCost'];
     $maxPrice = (int) $priceRange['maxCost'];
     $curMin = $_GET['lp'] ? (int) $_GET['lp'] : $minPrice;
     $curMax = $_GET['rp'] ? (int) $_GET['rp'] : $maxPrice;
     \CMSFactory\assetManager::create()->setData(array('minPrice' => (int) $priceRange['minCost'], 'maxPrice' => (int) $priceRange['maxCost'], 'curMax' => $curMax, 'curMin' => $curMin));
 }
Esempio n. 11
0
 public function index()
 {
     if ($this->installedProperties == false) {
         $this->install();
         $this->installProperties();
         $this->installedProperties = true;
     }
     /** Get all Banners from DB */
     /** Show Banners list */
     \CMSFactory\assetManager::create()->registerScript('main')->renderAdmin('list');
 }
Esempio n. 12
0
 /**
  * @covers mod_discount\Discount_product::get_product_discount_event
  */
 public function testGet_product_discount_event()
 {
     $product = array('id' => 191, 'vid' => 219);
     $this->object->get_product_discount_event($product);
     $disc = \CMSFactory\assetManager::create()->discount;
     $this->assertInternalType('array', $disc);
     $this->assertArrayHasKey('discoun_all_product', $disc);
     $this->assertArrayHasKey('discount_max', $disc);
     $this->assertArrayHasKey('discount_value', $disc);
     $this->assertArrayHasKey('price', $disc);
     $this->assertEquals('8250', $disc['price']);
     $this->assertEquals('7ns6g4r15w4t94jz', $disc['discount_max']['key']);
     $this->assertEquals('6600', $disc['discount_value']);
 }
Esempio n. 13
0
 public function get_link($identifier = null)
 {
     $outputData = array('paid' => false);
     if ($identifier) {
         $row = $this->db->select('custom_fields_data.field_data, shop_products.id')->where('url', $identifier)->join('custom_fields_data', 'custom_fields_data.entity_id = shop_products.id')->where('field_id', ShopCore::app()->SSettings->DPLinkCFID)->get('shop_products')->row();
         if ((bool) $row) {
             $order = $this->db->select('paid')->where('product_id', $row->id)->join('shop_orders_products', 'shop_orders_products.order_id = shop_orders.id')->where('user_id', $this->dx_auth->get_user_id())->get('shop_orders')->row();
             if ($order && $order->paid) {
                 $outputData['paid'] = true;
                 $outputData['link'] = $row->field_data;
             }
         }
     }
     \CMSFactory\assetManager::create()->setData($outputData)->render('dl_block', true);
 }
Esempio n. 14
0
 /**
  * Generates an array of data to create a body xml
  */
 public function index()
 {
     $ci = ShopCore::$ci;
     $this->settings = $this->ymarket_model->init();
     $this->currencyCode = ShopCore::app()->SCurrencyHelper->current->code;
     $categories = \Category\CategoryApi::getInstance()->getCategory($this->settings['unserCats']);
     /* @var $p SProducts */
     foreach ($this->ymarket_model->getProducts($this->settings['unserCats']) as $p) {
         $param = ShopCore::app()->SPropertiesRenderer->renderPropertiesArray($p);
         $additionalImages = $this->getAdditionalImages($p);
         /* @var $v SProductVariants */
         foreach ($p->getProductVariants() as $v) {
             if (!$v->getPrice()) {
                 continue;
             }
             $unique_id += $p->getId() . '.' . $v->getId();
             $this->offers[$unique_id]['url'] = $ci->config->item('base_url') . '/shop/product/' . $p->url;
             $this->offers[$unique_id]['price'] = $v->getPrice();
             $this->offers[$unique_id]['currencyId'] = $this->currencyCode;
             $this->offers[$unique_id]['categoryId'] = $p->getCategoryId();
             $this->offers[$unique_id]['picture'] = array_merge(array(productImageUrl('products/main/' . $v->getMainImage())), $additionalImages);
             $this->offers[$unique_id]['name'] = $this->forName($p->getName(), $v->getName());
             $this->offers[$unique_id]['vendor'] = $p->getBrand() ? htmlspecialchars($p->getBrand()->getName()) : '';
             $this->offers[$unique_id]['vendorCode'] = $v->getNumber() ? $v->getNumber() : '';
             $this->offers[$unique_id]['description'] = htmlspecialchars($p->getFullDescription());
             if ($this->settings['adult']) {
                 $this->offers[$unique_id]['adult'] = 'true';
             }
             $this->offers[$unique_id]['param'] = $param;
         }
     }
     $infoXml['categories'] = $categories;
     $infoXml['offers'] = $this->offers;
     $infoXml['site_short_title'] = $this->settings['site_short_title'];
     $infoXml['site_title'] = $this->settings['site_title'];
     $infoXml['base_url'] = $ci->config->item('base_url');
     $infoXml['imagecms_number'] = IMAGECMS_NUMBER;
     $infoXml['siteinfo_adminemail'] = siteinfo('siteinfo_adminemail');
     $infoXml['currencyCode'] = $this->currencyCode;
     \CMSFactory\assetManager::create()->setData('infoXml', $infoXml)->render('main', true);
     exit;
 }
 public function index()
 {
     $countTotalRows = (int) $this->db->get('trash')->num_rows();
     $perPage = (int) $this->input->get('per_page');
     if (empty($perPage)) {
         $perPage = 0;
     }
     $this->db->offset($perPage);
     $this->db->limit(25);
     $query = $this->db->get('trash')->result();
     $this->load->library('pagination');
     $config['base_url'] = site_url('admin/components/cp/trash?');
     $config['uri_segment'] = $perPage;
     $config['total_rows'] = $countTotalRows;
     $config['per_page'] = 25;
     $config['page_query_string'] = TRUE;
     $this->pagination->num_links = 5;
     $this->pagination->initialize($config);
     \CMSFactory\assetManager::create()->setData('model', $query)->setData('pagination', $this->pagination->create_links_ajax())->registerScript("admin")->renderAdmin('main');
 }
Esempio n. 16
0
 public function composeAndSendEmail($info)
 {
     $info['title'] = "New Callback has been added to your site";
     $message = \CMSFactory\assetManager::create()->setData('callback', $info)->fetchTemplate('email');
     $config['protocol'] = "smtp";
     $config['smtp_host'] = "ssl://smtp.gmail.com";
     $config['smtp_port'] = "465";
     $config['smtp_user'] = "******";
     $config['smtp_pass'] = "******";
     $config['charset'] = "utf-8";
     $config['mailtype'] = "html";
     $config['newline'] = "\r\n";
     $this->load->library('email');
     $this->email->initialize($config);
     $this->email->from('*****@*****.**', 'Callback Robots');
     $list = array('*****@*****.**');
     $this->email->to($list);
     $this->email->subject('New Callback received');
     $this->email->message($message);
     return $this->email->send();
 }
Esempio n. 17
0
 private function composeAndSendEmail($arg)
 {
     $comment = $this->db->where('id', $arg['commentId'])->get('comments')->row();
     if ($comment->module == 'core') {
         /** Используем помощник get_page($id) который аргументом принимает ID страницы.
          *  Помощник включен по умолчанию. Больше о функция помощника
          *  читайте здесь http://ellislab.com/codeigniter/user-guide/general/helpers.html */
         $comment->source = get_page($comment->item_id);
     }
     /** Теперь переменная содержит HTML тело нашего письма */
     $message = \CMSFactory\assetManager::create()->setData(array('comment' => $comment, 'key' => $this->key))->fetchTemplate('emailPattern');
     /** Настроявием отправку Email http://ellislab.com/codeigniter/user-guide/libraries/email.html */
     $this->load->library('email');
     $this->email->initialize(array('mailtype' => 'html'));
     $this->email->from('*****@*****.**', 'Comments Robot');
     $this->email->to($this->mailTo);
     $this->email->subject('New Comment received');
     $this->email->message($message);
     $this->email->send();
     //        echo $this->email->print_debugger();
 }
Esempio n. 18
0
 private static function fetchApiTpl()
 {
     $CI =& get_instance();
     $obj = $this ? $this : $CI;
     if (!$obj->input->is_ajax_request() || $obj->input->get('_pjax')) {
         $translator = $obj->db->where('name', 'translator')->get('components');
         if ($translator) {
             $translator = $translator->row_array();
             if ($translator['settings']) {
                 $translatorSettings = unserialize($translator['settings']);
                 if (isset($translatorSettings['showApiForm']) && $obj->dx_auth->is_admin()) {
                     if (!defined('ENABLE_TRANSLATION_API')) {
                         define('ENABLE_TRANSLATION_API', TRUE);
                     }
                     $lang = new MY_Lang();
                     $lang->load('translator');
                     \CMSFactory\assetManager::create()->registerScript('translateSingleLang');
                     $obj->template->include_tpl('translationApiForm', './application/modules/translator/assets/');
                 }
             }
         }
     }
 }
 /**
  * Data Autocomplete
  * @access public
  * @author L.Andriy <*****@*****.**>
  * @copyright (c) 2013, ImageCMS
  */
 public function autosearch()
 {
     switch ($this->input->post('queryString')) {
         case 'product':
             $entity = SProductsQuery::create()->joinWithI18n($this->def_locale)->filterByActive(true)->withColumn('SProductsI18n.Name', 'Name')->select(array('Id', 'Name'))->find()->toArray();
             break;
         case 'shop_category':
             $entity = SCategoryQuery::create()->joinWithI18n($this->def_locale)->withColumn('SCategoryI18n.Name', 'Name')->select(array('Id', 'Name'))->find()->toArray();
             break;
         case 'brand':
             $entity = SBrandsQuery::create()->joinWithI18n($this->def_locale)->withColumn('SBrandsI18n.Name', 'Name')->select(array('Id', 'Name'))->find()->toArray();
             break;
         case 'category':
             $entity = $this->db->select('id as Id')->select('name as Name')->get('category')->result_array();
             break;
         case 'page':
             $entity = $this->db->select('id as Id')->select('title as Name')->get('content')->result_array();
             break;
         case 'main':
             $entity = array(array('Id' => 0, 'Name' => lang('Main', 'banners')));
             break;
         default:
             break;
     }
     /** Show template with data */
     \CMSFactory\assetManager::create()->setData('entity', $entity)->render($this->input->post('tpl'), TRUE);
 }
Esempio n. 20
0
 public function index()
 {
     $query = $this->db->get('trash');
     \CMSFactory\assetManager::create()->setData('model', $query->result())->renderAdmin('main');
 }
Esempio n. 21
0
 /**
  * render add and move item popup
  *
  * @param type $varId
  * @param type $wish_list_id
  * @param type $user_id
  * @return type
  */
 public function renderPopup($varId, $wish_list_id, $user_id)
 {
     $wish_lists = $this->wishlist_model->getWishLists($user_id);
     $data = array('wish_lists' => $wish_lists);
     return $popup = \CMSFactory\assetManager::create()->registerStyle('style')->setData('class', 'btn')->setData('wish_list_id', $wish_list_id)->setData('varId', $varId)->setData('user_id', $user_id)->setData($data)->setData('max_lists_count', $this->settings['maxListsCount'])->renderAdmin('wishPopup');
 }
Esempio n. 22
0
 /**
  * render module additional region prices tab for products
  * @param array $data
  */
 public static function _extendPageAdmin($data)
 {
     $lang = new MY_Lang();
     $lang->load('exchangeunfu');
     $ci =& get_instance();
     if ($ci->uri->segment(6) == 'edit') {
         $array = $ci->db->where('product_id', $data['model']->getId())->join('mod_exchangeunfu_partners', 'mod_exchangeunfu_prices.partner_code=mod_exchangeunfu_partners.code')->get('mod_exchangeunfu_prices');
     } else {
         $array = array();
     }
     $partners = $ci->db->get('mod_exchangeunfu_partners');
     if ($partners) {
         $partners = $partners->result_array();
     } else {
         $partners = array();
     }
     if ($array) {
         $array = $array->result_array();
     } else {
         $array = array();
     }
     $partners_exist = array();
     foreach ($array as $key => $price) {
         $partners_exist[] = $price['partner_external_id'];
     }
     $view = \CMSFactory\assetManager::create()->registerScript('exchangeunfu')->setData('info', $array)->setData('partnets_exists', $partners_exist)->setData('partners', $partners)->fetchAdminTemplate('main');
     \CMSFactory\assetManager::create()->appendData('moduleAdditions', $view);
 }
 public function getTemplateVariables($locale = null)
 {
     if (null === $locale) {
         $locale = chose_language();
     }
     $template_id = $this->input->post('template_id');
     $variables = $this->email->getTemplateVariables($template_id, $locale);
     if ($variables) {
         return \CMSFactory\assetManager::create()->setData('variables', $variables)->render('variablesSelectOptions', true);
     } else {
         return FALSE;
     }
 }
Esempio n. 24
0
 public function index()
 {
     \CMSFactory\assetManager::create()->setData('settings', $this->get_settings())->renderAdmin('settings');
 }
Esempio n. 25
0
 /**
  * get data from Vkontakte
  */
 public function vk()
 {
     $this->core->set_meta_tags('SocAuts');
     if ($this->input->get()) {
         $curl = curl_init();
         curl_setopt($curl, CURLOPT_URL, "https://oauth.vk.com/access_token?client_id={$this->settings[vkClientID]}&client_secret={$this->settings[vkClientSecret]}&code={$this->input->get(code)}&redirect_uri=http://{$_SERVER['HTTP_HOST']}/socauth/vk");
         curl_setopt($curl, CURLOPT_HEADER, 0);
         curl_setopt($curl, CURLOPT_NOBODY, 0);
         curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
         curl_setopt($curl, CURLOPT_USERAGENT, 'MSIE 9');
         curl_setopt($curl, CURLOPT_REFERER, "{$_SERVER['HTTP_HOST']}/socauth/vk");
         $res = curl_exec($curl);
         $res = json_decode($res);
         curl_close($curl);
         $curl = curl_init();
         curl_setopt($curl, CURLOPT_URL, "https://api.vk.com/method/users.get?uids={$res->user_id}&fields=uid,first_name,last_name,nickname,screen_name,sex,bdate,city,country,timezone,photo,photo_medium,photo_big,email&access_token={$res->access_token}");
         curl_setopt($curl, CURLOPT_HEADER, 0);
         curl_setopt($curl, CURLOPT_NOBODY, 0);
         curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
         curl_setopt($curl, CURLOPT_USERAGENT, 'MSIE 9');
         curl_setopt($curl, CURLOPT_REFERER, "{$_SERVER['HTTP_HOST']}/socauth/vk");
         $res = curl_exec($curl);
         $res = json_decode($res);
         curl_close($curl);
         if ($res->error) {
             $this->error();
         }
         $isRegistereg = $this->db->join('users', 'mod_social.userId=users.id')->where('socialId', $res->response[0]->uid)->get('mod_social', 1)->row();
         if (count($isRegistereg) == 0) {
             \CMSFactory\assetManager::create()->setData('data', $res->response[0])->render('vklogin');
         } else {
             $this->socAuth('vk', $res->response[0]->uid, $res->response[0]->first_name . ' ' . $res->response[0]->last_name, $isRegistereg->email, '', '', '');
         }
     } elseif ($this->input->post()) {
         $this->load->helper(array('form', 'url'));
         $this->load->library('form_validation');
         $this->form_validation->set_rules('email', 'Email', 'required|valid_email|xss_clean|trim');
         $this->form_validation->run();
         if (!validation_errors()) {
             if (!$this->dx_auth->is_logged_in()) {
                 $this->socAuth('vk', $this->input->post('uid'), $this->input->post('name'), $this->input->post('email'), '', '', '');
             } else {
                 $this->link('vk', $this->input->post('uid'));
             }
         } else {
             redirect();
         }
     } else {
         $this->core->error_404();
     }
 }
Esempio n. 26
0
 /**
  * render new column template
  * @param string $column
  * @return type
  */
 public function renderNewColumn($column)
 {
     return \CMSFactory\assetManager::create()->setData('column', $column)->render('newColumn', true);
 }
Esempio n. 27
0
 /**
  * Render translated table
  * @return json
  */
 public function translate()
 {
     $po_array = (array) json_decode($this->input->post('po_array'));
     $result = (array) json_decode($this->input->post('results'));
     $withEmptyTranslation = $this->input->post('withEmptyTranslation');
     if ($po_array) {
         $counter = 0;
         foreach ($po_array as $origin => $value) {
             if ($origin) {
                 $po_array[$origin] = (array) $po_array[$origin];
                 if ($withEmptyTranslation != 'false') {
                     if (!strlen($po_array[$origin]['translation'])) {
                         $po_array[$origin]['translation'] = $result[$counter];
                     }
                 } else {
                     $po_array[$origin]['translation'] = $result[$counter];
                 }
                 $counter += 1;
             }
         }
         return json_encode(array('data' => \CMSFactory\assetManager::create()->setData('po_array', $po_array)->setData('page', 1)->setData('rows_count', ceil(count($po_array) / 11))->fetchAdminTemplate('po_table', FALSE)));
     }
 }
Esempio n. 28
0
 /**
  * Prepare and return template for module 
  * @param type $data
  * @param type $pageId
  * @return type
  */
 public function prepareInterface($data, $pageId)
 {
     $currentCategories = $this->db->where('content_id', $pageId)->get('mod_shop_news')->row_array();
     $currentCategories = explode(',', $currentCategories['shop_categories_ids']);
     return \CMSFactory\assetManager::create()->setData(array('shopNews' => $data, 'categories' => ShopCore::app()->SCategoryTree->getTree(), 'currentCategories' => $currentCategories))->registerScript('scripts')->fetchTemplate('/admin/adminModuleInterface');
 }
Esempio n. 29
0
 /**
  * register javascript
  * @deprecated since version 4.5.2
  * @copyright (c) 2013, ImageCMS
  */
 public function register_script()
 {
     \CMSFactory\assetManager::create()->registerScript('main', TRUE);
 }
Esempio n. 30
0
 /**
  * Display list of categories
  * @param type $cat_id
  * @param type $cur_page
  */
 public function byCategory($cat_id = 'all', $cur_page = 0)
 {
     if ($cat_id != 'all') {
         $db_where = array('category' => $cat_id, 'lang_alias' => 0);
     } else {
         $db_where = array('lang_alias' => 0);
     }
     ($hook = get_hook('admin_get_pages_by_cat')) ? eval($hook) : NULL;
     $offset = $this->uri->segment(7) == FALSE ? 0 : $this->uri->segment(7);
     $per_page = 12;
     $result = $this->db->limit($per_page, $offset)->where($db_where)->get('content');
     // count of all pages for pagination
     $total_pages = $this->documentation_model->getContentsCount($db_where);
     if ($result->num_rows > 0) {
         // Begin pagination
         $paginationConfig = array('base_url' => site_url('admin/components/cp/documentation/byCategory/' . $cat_id . '/'), 'container' => 'page', 'uri_segment' => 7, 'total_rows' => $total_pages, 'per_page' => $per_page, 'separate_controls' => true, 'full_tag_open' => '<div class="pagination pull-left"><ul>', 'full_tag_close' => '</ul></div>', 'controls_tag_open' => '<div class="pagination pull-right"><ul>', 'controls_tag_close' => '</ul></div>', 'next_link' => lang('Next', 'admin') . '&nbsp;&gt;', 'prev_link' => '&lt;&nbsp;' . lang('Prev', 'admin'), 'cur_tag_open' => '<li class="btn-primary active"><span>', 'cur_tag_close' => '</span></li>', 'prev_tag_open' => '<li>', 'prev_tag_close' => '</li>', 'next_tag_open' => '<li>', 'next_tag_close' => '</li>', 'num_tag_close' => '</li>', 'num_tag_open' => '<li>', 'num_tag_close' => '</li>', 'first_tag_open' => '<li>', 'first_tag_close' => '</li>', 'last_tag_open' => '<li>', 'last_tag_close' => '</li>');
         $this->pagination->num_links = 5;
         $this->pagination->initialize($paginationConfig);
         // End pagination
         $pages = $result->result_array();
         $data = array('paginator' => $this->pagination->create_links_ajax(), 'pages' => $pages, 'cat_id' => $cat_id, 'tree' => $this->lib_category->build(), 'show_cat_list' => 'yes', 'categories' => $this->documentation_model->getFirstLevelCategories());
     } else {
         $data = array('no_pages' => TRUE, 'tree' => $this->lib_category->build(), 'cat_id' => $cat_id, 'show_cat_list' => 'yes');
     }
     \CMSFactory\assetManager::create()->setData($data)->registerStyle('admin')->registerScript('admin')->renderAdmin("list");
 }