Пример #1
0
 protected function _gridRead($params)
 {
     if (1 == count($this->_iaCore->requestPath) && 'registration-email' == $this->_iaCore->requestPath[0]) {
         return $this->_resendRegistrationEmail();
     }
     return parent::_gridRead($params);
 }
Пример #2
0
 protected function _gridRead($params)
 {
     if ('usergroup' == $params['sort']) {
         $params['sort'] = 'usergroup_id';
     }
     return parent::_gridRead($params);
 }
Пример #3
0
 protected function _gridRead($params)
 {
     $action = 1 == count($this->_iaCore->requestPath) ? $this->_iaCore->requestPath[0] : null;
     switch ($action) {
         case 'items':
             $output = array('data' => null);
             if ($items = $this->_iaCore->factory('item')->getItems(true)) {
                 foreach ($items as $key => $item) {
                     $output['data'][] = array('title' => iaLanguage::get($item), 'value' => $item);
                 }
             }
             break;
         case 'plans':
             $output = array('data' => null);
             $stmt = '';
             if (!isset($params['itemname']) || isset($params['itemname']) && iaUsers::getItemName() == $params['itemname']) {
                 $stmt = iaDb::convertIds(iaUsers::getItemName(), 'item');
                 $output['data'][] = array('title' => iaLanguage::get('funds'), 'value' => 0);
             } elseif (!empty($params['itemname'])) {
                 $stmt = iaDb::convertIds($params['itemname'], 'item');
             }
             $this->_iaCore->factory('plan');
             if ($planIds = $this->_iaDb->onefield(iaDb::ID_COLUMN_SELECTION, $stmt, null, null, iaPlan::getTable())) {
                 foreach ($planIds as $planId) {
                     $output['data'][] = array('title' => iaLanguage::get('plan_title_' . $planId), 'value' => $planId);
                 }
             }
             break;
         case 'gateways':
             $output = array('data' => null);
             if ($items = $this->getHelper()->getPaymentGateways()) {
                 foreach ($items as $name => $title) {
                     $output['data'][] = array('value' => $name, 'title' => $title);
                 }
             }
             break;
         case 'members':
             $output = array('data' => null);
             if (!empty($params['query'])) {
                 $where[] = 'CONCAT(`username`, `fullname`) LIKE :username';
                 $values['username'] = '******' . iaSanitize::sql($params['query']) . '%';
             }
             $where || ($where[] = iaDb::EMPTY_CONDITION);
             $where = implode(' AND ', $where);
             $this->_iaDb->bind($where, $values);
             if ($members = $this->_iaDb->all(array('id', 'username', 'fullname'), $where, null, null, iaUsers::getTable())) {
                 foreach ($members as $member) {
                     $output['data'][] = array('title' => $member['username'], 'value' => $member['id']);
                 }
             }
             break;
         default:
             $output = parent::_gridRead($params);
     }
     return $output;
 }
Пример #4
0
 protected function _gridRead($params)
 {
     $output = array();
     $iaDb =& $this->_iaDb;
     switch ($params['get']) {
         case 'plugins':
             if ($plugins = $this->_iaDb->onefield('name', null, null, null, 'extras')) {
                 $output['data'][] = array('value' => iaCore::CORE, 'title' => iaLanguage::get('core', 'Core'));
                 foreach ($plugins as $plugin) {
                     $output['data'][] = array('value' => $plugin, 'title' => iaLanguage::get($plugin, ucfirst($plugin)));
                 }
             }
             break;
         case 'comparison':
             if (isset($params['lang1']) && isset($params['lang2']) && $params['lang1'] != $params['lang2'] && array_key_exists($params['lang1'], $this->_iaCore->languages) && array_key_exists($params['lang2'], $this->_iaCore->languages)) {
                 $start = isset($params['start']) ? (int) $params['start'] : 0;
                 $limit = isset($params['limit']) ? (int) $params['limit'] : 15;
                 $values = array();
                 if (!empty($params['key'])) {
                     $conditions[] = '`key` LIKE :key OR `value` LIKE :key';
                     $values['key'] = '%' . $params['key'] . '%';
                 }
                 if (!empty($params['category'])) {
                     $conditions[] = '`category` = :category';
                     $values['category'] = $params['category'];
                 }
                 if (!empty($params['plugin'])) {
                     if (iaCore::CORE == $params['plugin']) {
                         $params['plugin'] = '';
                     }
                     $conditions[] = '`extras` = :plugin';
                     $values['plugin'] = $params['plugin'];
                 }
                 $where = empty($conditions) ? iaDb::EMPTY_CONDITION : implode(' AND ', $conditions);
                 $iaDb->bind($where, $values);
                 $rows = $iaDb->all('SQL_CALC_FOUND_ROWS DISTINCT `key`, `category`', $where, $start, $limit);
                 $output = array('data' => array(), 'total' => $iaDb->foundRows());
                 $keys = array();
                 foreach ($rows as $row) {
                     $keys[] = $row['key'];
                 }
                 $stmt = "`code` = ':lang' AND `key` IN('" . implode("','", $keys) . "')";
                 $lang1 = $iaDb->keyvalue(array('key', 'value'), iaDb::printf($stmt, array('lang' => $params['lang1'])));
                 $lang2 = $iaDb->keyvalue(array('key', 'value'), iaDb::printf($stmt, array('lang' => $params['lang2'])));
                 foreach ($rows as $row) {
                     $key = $row['key'];
                     $output['data'][] = array('key' => $key, 'lang1' => isset($lang1[$key]) ? $lang1[$key] : null, 'lang2' => isset($lang2[$key]) ? $lang2[$key] : null, 'category' => $row['category']);
                 }
             }
             break;
         default:
             $params['lang'] = isset($_GET['lang']) && array_key_exists($_GET['lang'], $this->_iaCore->languages) ? $_GET['lang'] : $this->_iaCore->iaView->language;
             $output = parent::_gridRead($params);
     }
     return $output;
 }
Пример #5
0
 protected function _gridRead($params)
 {
     if (isset($params['get']) && 'groups' == $params['get']) {
         return $this->_iaDb->all(array('id', 'name'), iaDb::convertIds($_GET['item'], 'item'), null, null, iaField::getTableGroups());
     }
     if ($this->getName() != $this->_iaCore->iaView->name()) {
         $params['item'] = str_replace('_fields', '', $this->_iaCore->iaView->name());
     }
     return parent::_gridRead($params);
 }
 protected function _gridRead($params)
 {
     $action = empty($this->_iaCore->requestPath[0]) ? null : $this->_iaCore->requestPath[0];
     if (!is_null($action)) {
         $methodName = '_getJson' . ucfirst($action);
         if (is_callable(array($this, $methodName))) {
             return call_user_func(array($this, $methodName), $params);
         }
     }
     return parent::_gridRead($params);
 }
Пример #7
0
 protected function _gridRead($params)
 {
     $action = 1 == count($this->_iaCore->requestPath) ? $this->_iaCore->requestPath[0] : null;
     switch ($action) {
         case 'url':
             return $this->_getJsonUrl($params);
         case 'plugins':
             return $this->_getJsonPlugins();
         default:
             return parent::_gridRead($params);
     }
 }
Пример #8
0
 protected function _gridRead($params)
 {
     if (isset($_POST['action'])) {
         $output = array();
         switch ($_POST['action']) {
             case 'get':
                 $output['code'] = $this->_iaDb->one_bind('`code`', iaDb::convertIds((int) $_POST['id']));
                 break;
             case 'set':
                 $output['result'] = (bool) $this->_iaDb->update(array('code' => $_POST['code']), iaDb::convertIds($_POST['id']));
                 $output['message'] = iaLanguage::get($output['result'] ? 'saved' : 'db_error');
         }
         return $output;
     }
     return parent::_gridRead($params);
 }
Пример #9
0
 protected function _gridRead($params)
 {
     $output = array();
     switch ($this->_iaCore->requestPath[0]) {
         case 'get':
             $output['code'] = $this->_iaDb->one_bind('`code`', iaDb::convertIds((int) $_GET['id']));
             break;
         case 'set':
             $this->_iaDb->update(array('code' => $_POST['code']), iaDb::convertIds($_POST['id']));
             $output['result'] = 0 == $this->_iaDb->getErrorNumber();
             $output['message'] = iaLanguage::get($output['result'] ? 'saved' : 'db_error');
             break;
         default:
             $output = parent::_gridRead($params);
     }
     return $output;
 }
Пример #10
0
 protected function _gridRead($params)
 {
     $output = array();
     switch ($params['action']) {
         case 'pages':
             $pageGroups = $this->_iaCore->factory('page', iaCore::ADMIN)->getGroups();
             foreach ($pageGroups as $groupId => $group) {
                 $children = array();
                 foreach ($group['children'] as $pageId => $pageTitle) {
                     $children[] = array('text' => $pageTitle, 'leaf' => true, 'id' => $pageId);
                 }
                 $output[] = array('text' => $group['title'], 'id' => 'group_' . $groupId, 'cls' => 'folder', 'draggable' => false, 'children' => $children);
             }
             $output[0]['expanded'] = true;
             break;
         case 'menus':
             function recursiveRead($list, $pid = 0)
             {
                 $result = array();
                 if (isset($list[$pid])) {
                     foreach ($list[$pid] as $child) {
                         $title = iaLanguage::get('page_title_' . $child['el_id'], 'none');
                         if ($title == 'none') {
                             $title = iaLanguage::get('page_title_' . $child['page_name'], 'none');
                             if ($title == 'none' || $child['page_name'] == 'node') {
                                 $title = iaLanguage::get('_page_removed_');
                             }
                         } else {
                             $title .= (int) $child['el_id'] > 0 ? ' (custom)' : ' (no link)';
                         }
                         $item = array('text' => $title, 'id' => $child['el_id'], 'expanded' => true, 'children' => recursiveRead($list, $child['el_id']));
                         $result[] = $item;
                     }
                 }
                 return $result;
             }
             $output = array();
             if ($name = (int) $params['id']) {
                 $rows = $this->_iaDb->all(iaDb::ALL_COLUMNS_SELECTION, '`menu_id` = ' . $name . ' ORDER BY `id`', null, null, 'menus');
                 foreach ($rows as $row) {
                     $output[$row['parent_id']][] = $row;
                 }
                 $output = recursiveRead($output);
             }
             break;
         case 'titles':
             $output['languages'] = array();
             $languagesList = $this->_iaCore->languages;
             $node = isset($params['id']) ? iaSanitize::sql($params['id']) : false;
             $entry = isset($params['menu']) ? iaSanitize::sql($params['menu']) : false;
             if (isset($params['new']) && $params['new']) {
                 ksort($languagesList);
                 foreach ($languagesList as $code => $language) {
                     $output['languages'][] = array('fieldLabel' => $language['title'], 'name' => $code, 'value' => '');
                 }
             } elseif ($node && $entry) {
                 $key = false;
                 $title = iaLanguage::get('page_title_' . $node, 'none');
                 if ($title != 'none') {
                     $key = 'page_title_' . $node;
                 } else {
                     if ($pageId = (int) $node) {
                         $page = $this->_iaDb->one('`name`', iaDb::convertIds($pageId), 'pages');
                         $key = 'page_title_' . $page;
                     } else {
                         $current = isset($params['current']) ? $params['current'] : '';
                         ksort($languagesList);
                         foreach ($languagesList as $code => $language) {
                             $output['languages'][] = array('fieldLabel' => $language['title'], 'name' => $code, 'value' => $current);
                         }
                     }
                 }
                 if ($key) {
                     $titles = $this->_iaDb->all(iaDb::ALL_COLUMNS_SELECTION, "`key` = '{$key}' ORDER BY `code`", null, null, iaLanguage::getTable());
                     foreach ($titles as $row) {
                         if (isset($languagesList[$row['code']])) {
                             $output['languages'][] = array('fieldLabel' => $languagesList[$row['code']]['title'], 'name' => $row['code'], 'value' => $row['value']);
                         }
                     }
                 }
                 $output['key'] = $key;
             }
             break;
         case 'save':
             $output['message'] = iaLanguage::get('invalid_parameters');
             $menu = isset($params['menu']) ? $params['menu'] : null;
             $node = isset($params['node']) ? $params['node'] : null;
             if ($menu && $node) {
                 $rows = array();
                 foreach ($_POST as $code => $value) {
                     $rows[] = array('code' => $code, 'value' => $value, 'extras' => $menu, 'key' => 'page_title_' . $node, 'category' => iaLanguage::CATEGORY_PAGE);
                 }
                 $this->_iaDb->setTable(iaLanguage::getTable());
                 $this->_iaDb->delete('`key` = :key', null, array('key' => 'page_title_' . $node));
                 $this->_iaDb->insert($rows);
                 $this->_iaDb->resetTable();
                 $output['message'] = iaLanguage::get('saved');
                 $output['success'] = true;
                 $this->_iaCore->iaCache->remove('menu_' . $menu . '.inc');
             }
             break;
         default:
             $output = parent::_gridRead($params);
     }
     return $output;
 }
Пример #11
0
 protected function _gridRead($params)
 {
     return $this->_iaCore->requestPath && 'store' == end($this->_iaCore->requestPath) ? $this->_getUsergroups() : parent::_gridRead($params);
 }
Пример #12
0
 protected function _gridRead($params)
 {
     return count($this->_iaCore->requestPath) == 1 && 'positions' == $this->_iaCore->requestPath[0] ? $this->_getPositions() : parent::_gridRead($params);
 }
Пример #13
0
 protected function _gridRead($params)
 {
     return isset($params['get']) && 'tabs' == $params['get'] ? $this->_iaDb->onefield('name', "`item` = '{$params['item']}' AND `name` != '{$params['name']}' AND `tabview` = 1") : parent::_gridRead($params);
 }