Example #1
0
 /**
  * Application full view
  **/
 function appFullView()
 {
     $document =& JFactory::getDocument();
     $this->showSubmenu();
     $applicationName = JString::strtolower(JRequest::getVar('app', '', 'GET'));
     if (empty($applicationName)) {
         JError::raiseError(500, 'CC APP ID REQUIRED');
     }
     if (!$this->accessAllowed('registered')) {
         return;
     }
     $output = '';
     //@todo: Since group walls doesn't use application yet, we process it manually now.
     if ($applicationName == 'walls') {
         CFactory::load('libraries', 'wall');
         $jConfig = JFactory::getConfig();
         $limit = $jConfig->get('list_limit');
         $limitstart = JRequest::getVar('limitstart', 0, 'REQUEST');
         $eventId = JRequest::getVar('eventid', '', 'GET');
         $my = CFactory::getUser();
         $config = CFactory::getConfig();
         $eventsModel = CFactory::getModel('Events');
         $event =& JTable::getInstance('Event', 'CTable');
         $event->load($eventId);
         $config = CFactory::getConfig();
         $document->setTitle(JText::sprintf('CC EVENTS WALL TITLE', $event->title));
         CFactory::load('helpers', 'owner');
         $guest = $event->isMember($my->id);
         $waitingApproval = $event->isPendingApproval($my->id);
         $status = $event->getUserStatus($my->id);
         $responded = $status == COMMUNITY_EVENT_STATUS_ATTEND || $status == COMMUNITY_EVENT_STATUS_WONTATTEND || $status == COMMUNITY_EVENT_STATUS_MAYBE;
         if (!$config->get('lockeventwalls') || $config->get('lockeventwalls') && $guest && !$waitingApproval && $responded || COwnerHelper::isCommunityAdmin()) {
             $output .= CWallLibrary::getWallInputForm($event->id, 'events,ajaxSaveWall', 'events,ajaxRemoveWall');
             // Get the walls content
             $output .= '<div id="wallContent">';
             $output .= CWallLibrary::getWallContents('events', $event->id, $event->isAdmin($my->id), 0, $limitstart, 'wall.content', 'events,events');
             $output .= '</div>';
             jimport('joomla.html.pagination');
             $wallModel = CFactory::getModel('wall');
             $pagination = new JPagination($wallModel->getCount($event->id, 'events'), $limitstart, $limit);
             $output .= '<div class="pagination-container">' . $pagination->getPagesLinks() . '</div>';
         }
     } else {
         CFactory::load('libraries', 'apps');
         $model = CFactory::getModel('apps');
         $applications =& CAppPlugins::getInstance();
         $applicationId = $model->getUserApplicationId($applicationName);
         $application = $applications->get($applicationName, $applicationId);
         if (!$application) {
             JError::raiseError(500, 'CC APPLICATION NOT FOUND');
         }
         // Get the parameters
         $manifest = JPATH_PLUGINS . DS . 'community' . DS . $applicationName . DS . $applicationName . '.xml';
         $params = new JParameter($model->getUserAppParams($applicationId), $manifest);
         $application->params =& $params;
         $application->id = $applicationId;
         $output = $application->onAppDisplay($params);
     }
     echo $output;
 }
Example #2
0
 /**
  * Get language items and store them in an array
  *
  */
 function getTrans($lang, $item)
 {
     $app = JFactory::getApplication();
     $option = 'com_osmembership';
     $registry = new JRegistry();
     $languages = array();
     if (strpos($item, 'admin.') !== false) {
         $isAdmin = true;
         $item = substr($item, 6);
     } else {
         $isAdmin = false;
     }
     if ($isAdmin) {
         $path = JPATH_ROOT . '/administrator/language/en-GB/en-GB.' . $item . '.ini';
     } else {
         $path = JPATH_ROOT . '/language/en-GB/en-GB.' . $item . '.ini';
     }
     $registry->loadFile($path, 'INI');
     $languages['en-GB'][$item] = $registry->toArray();
     if ($isAdmin) {
         $path = JPATH_ROOT . '/administrator/language/' . $lang . '/' . $lang . '.' . $item . '.ini';
     } else {
         $path = JPATH_ROOT . '/language/' . $lang . '/' . $lang . '.' . $item . '.ini';
     }
     $search = $app->getUserStateFromRequest($option . 'search', 'search', '', 'string');
     $search = JString::strtolower($search);
     if (JFile::exists($path)) {
         $registry->loadFile($path, 'INI');
         $languages[$lang][$item] = $registry->toArray();
     } else {
         $languages[$lang][$item] = array();
     }
     return $languages;
 }
Example #3
0
 function displayItems()
 {
     $model = $this->getModel('logs');
     $lists = $model->getvar();
     $filter_order = $lists['filter_order'];
     $filter_order_Dir = $lists['filter_order_Dir'];
     $limit = $lists['limit'];
     $limitstart = $lists['limitstart'];
     $search = $lists['search'];
     $search = JString::strtolower($search);
     $where = $model->getWhereClause($lists);
     //echo $where;
     //order by
     $orderby = '  ORDER BY ' . $filter_order . ' ' . $filter_order_Dir;
     $total = $model->getItems($where, 1);
     //limit
     if ($limit > $total) {
         $limitstart = 0;
     }
     if ($limit == 0) {
         $limit = $total;
     }
     $limited = "  LIMIT " . $limitstart . ',' . $limit;
     jimport('joomla.html.pagination');
     $pageNav = new JPagination($total, $lists['limitstart'], $lists['limit']);
     $items = $model->getItems($where, 0, $orderby, $limited);
     $this->assign('items', $items);
     $this->assign('lists', $lists);
     $this->assign('pageNav', $pageNav);
 }
Example #4
0
 /**
  * @param array $params
  * @return array|mixed|null|string
  */
 public function render($params = array())
 {
     if (!$this->hasValue($params)) {
         return $this->renderWrapper();
     }
     $prices = $this->getPrices();
     $discount = JBCart::val();
     $curList = $discount->getCurList();
     if ($prices['save']->isNegative()) {
         $discount->set($prices['save']->val(), $prices['save']->cur());
     }
     /** @type JBCartValue $total */
     $total = $prices['total'];
     $message = JText::_(JString::trim($params->get('empty_text', '')));
     $layout = $params->get('layout', 'full-div');
     if ($total->isEmpty() && !empty($message)) {
         $layout = 'empty';
     }
     if ($layout == 'totla-cur' && isset($curList[$total->cur()])) {
         unset($curList[$total->cur()]);
     }
     unset($curList[JBCartValue::DEFAULT_CODE]);
     if ($layout = $this->getLayout($layout . '.php')) {
         return $this->renderLayout($layout, array('total' => $total, 'price' => $prices['price'], 'save' => $prices['save']->abs(true), 'discount' => $discount->abs(), 'currency' => $this->currency(), 'curList' => $curList, 'message' => $message));
     }
     return null;
 }
Example #5
0
 public function getThumbnail($obj)
 {
     $config = CFactory::getConfig();
     $file = $obj->thumb;
     // Site origin
     if (JString::substr($file, 0, 4) == 'http') {
         $uri = $file;
         return $uri;
     }
     // Remote storage
     if ($obj->storage != 'file') {
         $storage = CStorage::getStorage($obj->storage);
         $uri = $storage->getURI($file);
         return $uri;
     }
     // Default thumbnail
     if (empty($file) || !JFile::exists(JPATH_ROOT . '/' . $file)) {
         $template = new CTemplateHelper();
         $asset = $template->getTemplateAsset('video_thumb.png', 'images');
         $uri = $asset->url;
         return $uri;
     }
     // Strip cdn path if exists.
     // Note: At one point, cdn path was stored along with the thumbnail path
     //       in the db which is the mistake we are trying to rectify here.
     $file = str_ireplace($config->get('videocdnpath'), '', $file);
     // CDN or local
     $baseUrl = $config->get('videobaseurl') or $baseUrl = JURI::root();
     $uri = str_replace('\\', '/', rtrim($baseUrl, '/') . '/' . ltrim($file, '/'));
     return $uri;
 }
Example #6
0
 /**
  * Tareas comunes a pantalla de listas
  *
  */
 function configure()
 {
     $option = JRequest::getCMD('option');
     $mainframe = JFactory::getApplication();
     // orden
     $filter_order = $mainframe->getUserStateFromRequest($this->_context . 'filter_order', 'filter_order', $this->_orderfield, 'cmd');
     $filter_order_Dir = $mainframe->getUserStateFromRequest($this->_context . 'filter_order_Dir', 'filter_order_Dir', 'asc', 'word');
     // cadena de búsqueda
     $search = $mainframe->getUserStateFromRequest($this->_context . 'search', 'search', '', 'string');
     $search = JString::strtolower($search);
     // Configuramos el modelo
     $model =& $this->getModel();
     $model->_orderby_filter_order = $filter_order;
     $model->_orderby_filter_order_dir = $filter_order_Dir;
     // seteamos búsqueda en el modelo
     $db = JFactory::getDBO();
     if ($search) {
         $model->setWhere('LOWER(' . $this->_searchfield . ') LIKE ' . $db->Quote('%' . $db->getEscaped($search, true) . '%', false));
     }
     // table ordering
     $this->_lists['order_Dir'] = $filter_order_Dir;
     $this->_lists['order'] = $filter_order;
     $this->_lists['search'] = $search;
     $this->assignRef('lists', $this->_lists);
 }
Example #7
0
 function check()
 {
     if (JString::trim($this->url) != '' && substr($this->url, 0, 7) != 'http://') {
         $this->url = 'http://' . $this->url;
     }
     return true;
 }
Example #8
0
 function check()
 {
     //initialize
     $this->_error = null;
     $this->oldurl = JString::trim($this->oldurl);
     $this->newurl = JString::trim($this->newurl);
     // check for valid URLs
     if ($this->oldurl == '' || $this->newurl == '') {
         $this->_error .= JTExt::_('COM_SH404SEF_EMPTYURL');
         return false;
     }
     if (JString::substr($this->oldurl, 0, 1) == '/') {
         $this->_error .= JText::_('COM_SH404SEF_NOLEADSLASH');
     }
     if (JString::substr($this->newurl, 0, 9) != 'index.php') {
         $this->_error .= JText::_('COM_SH404SEF_BADURL');
     }
     // V 1.2.4.t remove this check. We check for pre-existing non-sef instead of SEF
     if (is_null($this->_error)) {
         // check for existing URLS
         $this->_db->setQuery("SELECT id,oldurl FROM #__sh404sef_urls WHERE `newurl` LIKE " . $this->_db->Quote($this->newurl));
         $xid = $this->_db->loadObject();
         // V 1.3.1 don't raise error if both newurl and old url are same. It means we may have changed alias list
         if ($xid && $xid->id != intval($this->id)) {
             $this->_error = JText::_('COM_SH404SEF_URLEXIST');
             return false;
         }
         $identical = $xid->id == intval($this->id) && $xid->oldurl == $this->oldurl;
         return $identical ? 'identical' : true;
     } else {
         return false;
     }
 }
Example #9
0
 function _buildContentWhere()
 {
     global $mainframe, $option;
     $db =& JFactory::getDBO();
     $where = null;
     $filterState = $mainframe->getUserStateFromRequest('com_imageshow.showcase.filter_state', 'filter_state', '', 'word');
     $filter_order = $mainframe->getUserStateFromRequest('com_imageshow.showcase.filter_order', 'filter_order', '', 'cmd');
     $filter_order_Dir = $mainframe->getUserStateFromRequest('com_imageshow.showcase.filter_order_Dir', 'filter_order_Dir', '', 'word');
     $showcaseTitle = $mainframe->getUserStateFromRequest('com_imageshow.showcase.showcase_title', 'showcase_title', '', 'string');
     $showcaseTitle = JString::strtolower($showcaseTitle);
     if ($showcaseTitle) {
         $where[] = 'LOWER(showcase_title) LIKE ' . $db->Quote('%' . $db->getEscaped($showcaseTitle, true) . '%', false);
     }
     if ($filterState) {
         if ($filterState == 'P') {
             $where[] = 'published = 1';
         } else {
             if ($filterState == 'U') {
                 $where[] = 'published = 0';
             }
         }
     }
     $where = count($where) ? ' WHERE ' . implode(' AND ', $where) : '';
     return $where;
 }
Example #10
0
 function _buildContentWhere()
 {
     global $mainframe;
     $context = 'com_phocagallery.phocagallery.list.';
     $filter_state = $mainframe->getUserStateFromRequest($context . 'filter_state', 'filter_state', '', 'word');
     $filter_catid = $mainframe->getUserStateFromRequest($context . 'filter_catid', 'filter_catid', 0, 'int');
     $filter_order = $mainframe->getUserStateFromRequest($context . 'filter_order', 'filter_order', 'a.ordering', 'cmd');
     $filter_order_Dir = $mainframe->getUserStateFromRequest($context . 'filter_order_Dir', 'filter_order_Dir', '', 'word');
     $search = $mainframe->getUserStateFromRequest($context . 'search', 'search', '', 'string');
     $search = JString::strtolower($search);
     $where = array();
     if ($filter_catid > 0) {
         $where[] = 'a.catid = ' . (int) $filter_catid;
     }
     if ($search) {
         $where[] = 'LOWER(a.title) LIKE ' . $this->_db->Quote('%' . $search . '%');
     }
     if ($filter_state) {
         if ($filter_state == 'P') {
             $where[] = 'a.published = 1';
         } else {
             if ($filter_state == 'U') {
                 $where[] = 'a.published = 0';
             }
         }
     }
     $where = count($where) ? ' WHERE ' . implode(' AND ', $where) : '';
     return $where;
 }
 public function execute($item, $calendar)
 {
     $model = FD::model('comments');
     $users = $model->getParticipants($item->uid, $item->context_type);
     // Include the notification actor
     $users[] = $item->actor_id;
     // Exclude the current user
     $users = array_values(array_unique(array_diff($users, array(FD::user()->id))));
     $names = FD::string()->namesToNotifications($users);
     $plurality = count($users) > 1 ? '_PLURAL' : '_SINGULAR';
     $content = '';
     if (count($users) == 1 && !empty($item->content)) {
         $content = JString::substr(strip_tags($item->content), 0, 30);
         if (JString::strlen($item->content) > 30) {
             $content .= JText::_('COM_EASYSOCIAL_ELLIPSES');
         }
     }
     $item->content = $content;
     if ($calendar->user_id == $item->target_id && $item->target_type == SOCIAL_TYPE_USER) {
         $item->title = JText::sprintf('APP_USER_CALENDAR_USER_COMMENTED_ON_YOUR_EVENT' . $plurality, $names);
         return $item;
     }
     if ($calendar->user_id == $item->actor_id && count($users) == 1) {
         $item->title = JText::sprintf('APP_USER_CALENDAR_OWNER_COMMENTED_ON_EVENT' . FD::user($calendar->user_id)->getGendarLang(), $names);
         return $item;
     }
     $item->title = JText::sprintf('APP_USER_CALENDAR_USER_COMMENTED_ON_USER_EVENT' . $plurality, $names, FD::user($calendar->user_id)->getName());
     return $item;
 }
Example #12
0
 public static function transliterate($string)
 {
     switch (uk_UALocalise::simple_detect_language($string)) {
         case 'ru':
             $str = JString::strtolower($string);
             $glyph_array = array('a' => 'а', 'b' => 'б', 'v' => 'в', 'g' => 'г,ґ', 'd' => 'д', 'e' => 'е,є,э', 'jo' => 'ё', 'zh' => 'ж', 'z' => 'з', 'i' => 'и,і', 'ji' => 'ї', 'j' => 'й', 'k' => 'к', 'l' => 'л', 'm' => 'м', 'n' => 'н', 'o' => 'о', 'p' => 'п', 'r' => 'р', 's' => 'с', 't' => 'т', 'u' => 'у', 'f' => 'ф', 'kh' => 'х', 'ts' => 'ц', 'ch' => 'ч', 'sh' => 'ш', 'shch' => 'щ', '' => 'ъ', 'y' => 'ы', '' => 'ь', 'yu' => 'ю', 'ya' => 'я', '' => '—', '' => '!', '' => '?', '' => ':', '' => ';', '' => ',', '' => '’', '' => '\'', '' => '--', '' => '.', '' => '@', '' => '', '' => '^', '' => '*', '' => '(', '' => ')', '' => '_', '' => '=', '' => '+', 'uah' => '₴', 'eur' => '€', 'usd' => '$', 'protsen' => '%');
             foreach ($glyph_array as $letter => $glyphs) {
                 $glyphs = explode(',', $glyphs);
                 $str = str_replace($glyphs, $letter, $str);
             }
             $str = preg_replace('#\\&\\#?[a-z0-9]+\\;#ismu', '', $str);
             return $str;
             break;
         default:
         case 'ua':
             $trans = array("а" => "a", "б" => "b", "в" => "v", "г" => "h", "ґ" => "g", "д" => "d", "е" => "e", "ё" => "e", "э" => "e", "є" => "ie", "ж" => "zh", "з" => "z", "и" => "y", "ы" => "y", "і" => "i", "ї" => "i", "й" => "i", "к" => "k", "л" => "l", "м" => "m", "н" => "n", "о" => "o", "п" => "p", "р" => "r", "с" => "s", "т" => "t", "у" => "u", "ф" => "f", "х" => "kh", "ц" => "ts", "ч" => "ch", "ш" => "sh", "щ" => "shch", "ю" => "iu", "я" => "ia", "ь" => "", "Ь" => "", "ъ" => "", "Ъ" => "", "!" => "", "?" => "", ":" => "", ";" => "", "’" => "", "'" => "", "—" => "", "--" => "", "-" => "", "." => "", "@" => "", "#" => "", "#" => "", "^" => "", "*" => "", "(" => "", ")" => "", "_" => "", "=" => "", "+" => "", "₴" => "uah", "€" => "eur", "\$" => "usd", "%" => "protsent", 'à' => 'a', 'ô' => 'o', 'ď' => 'd', 'ḟ' => 'f', 'ë' => 'e', 'š' => 's', 'ơ' => 'o', 'ß' => 'ss', 'ă' => 'a', 'ř' => 'r', 'ț' => 't', 'ň' => 'n', 'ā' => 'a', 'ķ' => 'k', 'ŝ' => 's', 'ỳ' => 'y', 'ņ' => 'n', 'ĺ' => 'l', 'ħ' => 'h', 'ṗ' => 'p', 'ó' => 'o', 'ú' => 'u', 'ě' => 'e', 'é' => 'e', 'ç' => 'c', 'ẁ' => 'w', 'ċ' => 'c', 'õ' => 'o', 'ṡ' => 's', 'ø' => 'o', 'ģ' => 'g', 'ŧ' => 't', 'ș' => 's', 'ė' => 'e', 'ĉ' => 'c', 'ś' => 's', 'î' => 'i', 'ű' => 'u', 'ć' => 'c', 'ę' => 'e', 'ŵ' => 'w', 'ṫ' => 't', 'ū' => 'u', 'č' => 'c', 'ö' => 'oe', 'è' => 'e', 'ŷ' => 'y', 'ą' => 'a', 'ł' => 'l', 'ų' => 'u', 'ů' => 'u', 'ş' => 's', 'ğ' => 'g', 'ļ' => 'l', 'ƒ' => 'f', 'ž' => 'z', 'ẃ' => 'w', 'ḃ' => 'b', 'å' => 'a', 'ì' => 'i', 'ï' => 'i', 'ḋ' => 'd', 'ť' => 't', 'ŗ' => 'r', 'ä' => 'ae', 'í' => 'i', 'ŕ' => 'r', 'ê' => 'e', 'ü' => 'ue', 'ò' => 'o', 'ē' => 'e', 'ñ' => 'n', 'ń' => 'n', 'ĥ' => 'h', 'ĝ' => 'g', 'đ' => 'd', 'ĵ' => 'j', 'ÿ' => 'y', 'ũ' => 'u', 'ŭ' => 'u', 'ư' => 'u', 'ţ' => 't', 'ý' => 'y', 'ő' => 'o', 'â' => 'a', 'ľ' => 'l', 'ẅ' => 'w', 'ż' => 'z', 'ī' => 'i', 'ã' => 'a', 'ġ' => 'g', 'ṁ' => 'm', 'ō' => 'o', 'ĩ' => 'i', 'ù' => 'u', 'į' => 'i', 'ź' => 'z', 'á' => 'a', 'û' => 'u', 'þ' => 'th', 'ð' => 'dh', 'æ' => 'ae', 'µ' => 'u', 'ĕ' => 'e', 'œ' => 'oe', "А" => "A", "Б" => "B", "В" => "V", "Г" => "H", "Ґ" => "G", "Д" => "D", "Е" => "E", "Ё" => "E", "Э" => "E", "Є" => "Ye", "Ж" => "Zh", "З" => "Z", "И" => "Y", "Й" => "Y", "Ы" => "Y", "І" => "I", "Ї" => "Yi", "К" => "K", "Л" => "L", "М" => "M", "Н" => "N", "О" => "O", "П" => "P", "Р" => "R", "С" => "S", "Т" => "T", "У" => "U", "Ф" => "F", "Х" => "Kh", "Ц" => "Ts", "Ч" => "Ch", "Ш" => "Sh", "Щ" => "Shch", "Ю" => "Yu", "Я" => "Ya", 'À' => 'A', 'Ô' => 'O', 'Ď' => 'D', 'Ḟ' => 'F', 'Ë' => 'E', 'Š' => 'S', 'Ơ' => 'O', 'Ă' => 'A', 'Ř' => 'R', 'Ț' => 'T', 'Ň' => 'N', 'Ā' => 'A', 'Ķ' => 'K', 'Ŝ' => 'S', 'Ỳ' => 'Y', 'Ņ' => 'N', 'Ĺ' => 'L', 'Ħ' => 'H', 'Ṗ' => 'P', 'Ó' => 'O', 'Ú' => 'U', 'Ě' => 'E', 'É' => 'E', 'Ç' => 'C', 'Ẁ' => 'W', 'Ċ' => 'C', 'Õ' => 'O', 'Ṡ' => 'S', 'Ø' => 'O', 'Ģ' => 'G', 'Ŧ' => 'T', 'Ș' => 'S', 'Ė' => 'E', 'Ĉ' => 'C', 'Ś' => 'S', 'Î' => 'I', 'Ű' => 'U', 'Ć' => 'C', 'Ę' => 'E', 'Ŵ' => 'W', 'Ṫ' => 'T', 'Ū' => 'U', 'Č' => 'C', 'Ö' => 'Oe', 'È' => 'E', 'Ŷ' => 'Y', 'Ą' => 'A', 'Ł' => 'L', 'Ų' => 'U', 'Ů' => 'U', 'Ş' => 'S', 'Ğ' => 'G', 'Ļ' => 'L', 'Ƒ' => 'F', 'Ž' => 'Z', 'Ẃ' => 'W', 'Ḃ' => 'B', 'Å' => 'A', 'Ì' => 'I', 'Ï' => 'I', 'Ḋ' => 'D', 'Ť' => 'T', 'Ŗ' => 'R', 'Ä' => 'Ae', 'Í' => 'I', 'Ŕ' => 'R', 'Ê' => 'E', 'Ü' => 'Ue', 'Ò' => 'O', 'Ē' => 'E', 'Ñ' => 'N', 'Ń' => 'N', 'Ĥ' => 'H', 'Ĝ' => 'G', 'Đ' => 'D', 'Ĵ' => 'J', 'Ÿ' => 'Y', 'Ũ' => 'U', 'Ŭ' => 'U', 'Ư' => 'U', 'Ţ' => 'T', 'Ý' => 'Y', 'Ő' => 'O', 'Â' => 'A', 'Ľ' => 'L', 'Ẅ' => 'W', 'Ż' => 'Z', 'Ī' => 'I', 'Ã' => 'A', 'Ġ' => 'G', 'Ṁ' => 'M', 'Ō' => 'O', 'Ĩ' => 'I', 'Ù' => 'U', 'Į' => 'I', 'Ź' => 'Z', 'Á' => 'A', 'Û' => 'U', 'Þ' => 'Th', 'Ð' => 'Dh', 'Æ' => 'Ae', 'Ĕ' => 'E', 'Œ' => 'Oe');
             if (preg_match("/[а-яА-Яa-zA-Z]/", $string)) {
                 $str = strtr($string, $trans);
             } else {
                 $str = $string;
             }
             $str = preg_replace('#\\&\\#?[a-z0-9]+\\;#ismu', '', $str);
             return $str;
             break;
     }
 }
 protected function prepareGroupField()
 {
     $basetype = isset($this->element['basetype']) ? $this->element['basetype'] : 'text';
     $basetype = (string) $basetype;
     $first_char = JString::substr($this->element['name'], 0, 1);
     $last_char = JString::substr($this->element['name'], JString::strlen($this->element['name']) - 1, 1);
     if ($basetype == 'group') {
         //If start or end of group
         if ($first_char == "{") {
             // Починаю нову групу (може бути будь-якого рівня вкладеності)
             $GLOBALS['variablefield']['output'] = false;
             $GLOBALS['variablefield']['current_group'][] = (string) $this->element['name'] . '}';
             // Lower in the code I know, that last element of array $GLOBALS['variablefield']['current_group'] is always the current group.
             $this->groupstate = 'start';
             $GLOBALS['variablefield']['fields'][] = clone $this;
             // I must clone
         } else {
             if ($last_char == "}") {
                 $this->groupstate = 'end';
                 $GLOBALS['variablefield']['fields'][] = clone $this;
                 array_pop($GLOBALS['variablefield']['current_group']);
                 if (empty($GLOBALS['variablefield']['current_group'])) {
                     $GLOBALS['variablefield']['output'] = true;
                 }
             }
         }
     } else {
         if (!empty($GLOBALS['variablefield']['current_group'])) {
             // If in element from inside the group
             $this->groupstate = 'continue';
             $this->defaultvalue = $this->value;
             $GLOBALS['variablefield']['fields'][] = clone $this;
         }
     }
 }
Example #14
0
 function display()
 {
     global $option, $mainframe;
     $document =& JFactory::getDocument();
     $view =& $this->getView(JRequest::getVar('controller', 'querydefinitions'), $document->getType());
     $model =& $this->getModel('querydefinitions');
     $user =& JFactory::getUser();
     $context = 'com_kbi.querydefinitions.list';
     $filter_order = $mainframe->getUserStateFromRequest($context . 'filter_order', 'filter_order', 'name', 'cmd');
     $filter_order_Dir = $mainframe->getUserStateFromRequest($context . 'filter_order_Dir', 'filter_order_Dir', '', 'word');
     $search = $mainframe->getUserStateFromRequest($context . 'search', 'search', '', 'string');
     $search = JString::strtolower($search);
     $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
     $limitstart = $mainframe->getUserStateFromRequest($context . 'limitstart', 'limitstart', 0, 'int');
     $orderby = ' ORDER BY ' . $filter_order . ' ' . $filter_order_Dir . ', id';
     $rows = $model->getList($total, $limitstart, $limit, $search, $orderby);
     jimport('joomla.html.pagination');
     $pageNav = new JPagination($total, $limitstart, $limit);
     // table ordering
     $lists['order_Dir'] = $filter_order_Dir;
     $lists['order'] = $filter_order;
     // search filter
     $lists['search'] = $search;
     $view->setLayout('default');
     $view->assignRef('rows', $rows);
     $view->assignRef('pageNav', $pageNav);
     $view->assignRef('lists', $lists);
     $view->display();
 }
Example #15
0
 public function display($tpl = null)
 {
     $app = JFactory::getApplication('');
     if ($this->getLayout() == 'form') {
         $this->_displayForm($tpl);
         return;
     }
     $context = 'com_jacc' . '.' . strtolower($this->getName()) . '.list.';
     $filter_state = $app->getUserStateFromRequest($context . 'filter_state', 'filter_state', '', 'word');
     $filter_order = $app->getUserStateFromRequest($context . 'filter_order', 'filter_order', $this->get('DefaultFilter'), 'cmd');
     $filter_order_Dir = $app->getUserStateFromRequest($context . 'filter_order_Dir', 'filter_order_Dir', '', 'word');
     $search = $app->getUserStateFromRequest($context . 'search', 'search', '', 'string');
     $search = JString::strtolower($search);
     // Get data from the model
     $this->total = $this->get('Total');
     $this->pagination = $this->get('Pagination');
     //create the lists
     $lists = array();
     $lists['state'] = JHTML::_('grid.state', $filter_state);
     // table ordering
     $lists['order_Dir'] = $filter_order_Dir;
     $lists['order'] = $filter_order;
     // search filter
     $lists['search'] = $search;
     $this->items = $this->get('Data');
     $this->user = JFactory::getUser();
     $this->lists = $lists;
     parent::display();
 }
Example #16
0
    public function getFieldHTML($field, $required)
    {
        $required = $field->required == 1 ? ' data-required="true"' : '';
        //a fix for wrong data
        $field->value = JString::trim($field->value);
        if (JString::strrpos($field->value, ',') == JString::strlen($field->value) - 1) {
            $field->value = JString::substr($field->value, 0, -1);
        }
        $lists = explode(',', $field->value);
        //CFactory::load( 'helpers' , 'string' );
        $html = '<select id="field' . $field->id . '" name="field' . $field->id . '[]" type="select-multiple" multiple="multiple" class="joms-select joms-select--multiple" title="' . CStringHelper::escape(JText::_($field->tips)) . '" ' . $required . '>';
        $elementSelected = 0;
        foreach ($field->options as $option) {
            $selected = in_array($option, $lists) ? ' selected="selected"' : '';
            if (empty($selected)) {
                $elementSelected++;
            }
            $html .= '<option value="' . $option . '"' . $selected . '>' . JText::_($option) . '</option>';
        }
        if ($elementSelected == 0) {
            //if nothing is selected, we default the 1st option to be selected.
            $elementName = 'field' . $field->id;
            $html .= <<<HTML

                   <script type='text/javascript'>
                       var slt = document.getElementById('{$elementName}');
                       if(slt != null){
                          slt.options[0].selected = true;
                       }
                   </script>
HTML;
        }
        $html .= '</select>';
        return $html;
    }
Example #17
0
 function save($url = null)
 {
     if (!JSession::checkToken('post')) {
         $this->app->enqueueMessage(JText::_('COM_KUNENA_ERROR_TOKEN'), 'error');
         $this->app->redirect(KunenaRoute::_($this->baseurl, false));
     }
     $properties = $this->config->getProperties();
     foreach (JRequest::get('post', JREQUEST_ALLOWHTML) as $postsetting => $postvalue) {
         if (JString::strpos($postsetting, 'cfg_') === 0) {
             //remove cfg_ and force lower case
             if (is_array($postvalue)) {
                 $postvalue = implode(',', $postvalue);
             }
             $postname = JString::strtolower(JString::substr($postsetting, 4));
             // No matter what got posted, we only store config parameters defined
             // in the config class. Anything else posted gets ignored.
             if (array_key_exists($postname, $properties)) {
                 $this->config->set($postname, $postvalue);
             }
         }
     }
     $this->config->save();
     $this->app->enqueueMessage(JText::_('COM_KUNENA_CONFIGSAVED'));
     if (empty($url)) {
         $this->app->redirect(KunenaRoute::_($this->kunenabaseurl, false));
     } else {
         $this->app->redirect(KunenaRoute::_($url, false));
     }
 }
Example #18
0
 function display($tpl = null)
 {
     $document = JFactory::getDocument();
     $user = JFactory::getUser();
     $mainframe = JFactory::getApplication();
     if (Komento::joomlaVersion() >= '1.6') {
         if (!$user->authorise('komento.manage.pendings', 'com_komento')) {
             $mainframe->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error');
             $mainframe->close();
         }
     }
     $filter_component = $mainframe->getUserStateFromRequest('com_komento.pending.filter_component', 'filter_component', '*', 'string');
     $search = $mainframe->getUserStateFromRequest('com_komento.pending.search', 'search', '', 'string');
     $search = trim(JString::strtolower($search));
     $order = $mainframe->getUserStateFromRequest('com_komento.pending.filter_order', 'filter_order', 'created', 'cmd');
     $orderDirection = $mainframe->getUserStateFromRequest('com_komento.pending.filter_order_Dir', 'filter_order_Dir', 'DESC', 'word');
     // Set Options
     $options['published'] = 2;
     $options['no_tree'] = 1;
     $options['no_child'] = 1;
     // Get data from the model
     $commentsModel = Komento::getModel('comments');
     $comments = $commentsModel->getData($options);
     $pagination = $commentsModel->getPagination();
     $this->assignRef('comments', $comments);
     $this->assignRef('pagination', $pagination);
     $this->assign('search', $search);
     $this->assign('order', $order);
     $this->assign('orderDirection', $orderDirection);
     $this->assign('component', $this->getComponentState($filter_component));
     $this->assign('columns', Komento::getConfig('com_komento_pending_columns', false));
     $this->assign('columnCount', 2);
     parent::display($tpl);
 }
Example #19
0
 /**
  * Description
  *
  * @param string SQL with ordering As value and 'name field' AS text
  * @param integer The length of the truncated headline
  * @since 1.5
  */
 function genericordering($sql, $chop = '30')
 {
     $db =& JFactory::getDBO();
     $order = array();
     $db->setQuery($sql);
     if (!($orders = $db->loadObjectList())) {
         if ($db->getErrorNum()) {
             echo $db->stderr();
             return false;
         } else {
             $order[] = JHTML::_('select.option', 1, JText::_('first'));
             return $order;
         }
     }
     $order[] = JHTML::_('select.option', 0, '0 ' . JText::_('first'));
     for ($i = 0, $n = count($orders); $i < $n; $i++) {
         if (JString::strlen($orders[$i]->text) > $chop) {
             $text = JString::substr($orders[$i]->text, 0, $chop) . "...";
         } else {
             $text = $orders[$i]->text;
         }
         $order[] = JHTML::_('select.option', $orders[$i]->value, $orders[$i]->value . ' (' . $text . ')');
     }
     $order[] = JHTML::_('select.option', $orders[$i - 1]->value + 1, $orders[$i - 1]->value + 1 . ' ' . JText::_('last'));
     return $order;
 }
Example #20
0
 /**
  * Validates the username.
  *
  * @since	1.0
  * @access	public
  * @param	null
  * @return	JSON	A jsong encoded string.
  *
  * @author	Jason Rey <jasonrey@stackideas.com>
  */
 public function isValid()
 {
     // Render the ajax lib.
     $ajax = FD::getInstance('Ajax');
     // Get the userid
     $userid = JRequest::getInt('userid', 0);
     // Get the event
     $event = JRequest::getString('event');
     // Set the current username
     $current = '';
     if (!empty($userid)) {
         $user = FD::user($userid);
         $current = $user->username;
     }
     // Get the provided username that the user has typed.
     $username = JRequest::getVar('username', '');
     // Username is required, check if username is empty
     if (JString::strlen($username) < $this->params->get('min')) {
         return $ajax->reject(JText::sprintf('PLG_FIELDS_JOOMLA_USERNAME_MIN_CHARACTERS', $this->params->get('min')));
     }
     // Test if username is allowed (by pass for adminedit).
     if ($event !== 'onAdminEdit' && !SocialFieldsUserJoomlaUsernameHelper::allowed($username, $this->params)) {
         return $ajax->reject(JText::_('PLG_FIELDS_JOOMLA_USERNAME_NOT_ALLOWED'));
     }
     // Test if username exists.
     if (SocialFieldsUserJoomlaUsernameHelper::exists($username, $current)) {
         return $ajax->reject(JText::_('PLG_FIELDS_JOOMLA_USERNAME_NOT_AVAILABLE'));
     }
     // Test if the username is valid
     if (!SocialFieldsUserJoomlaUsernameHelper::isValid($username, $this->params)) {
         return $ajax->reject(JText::_('PLG_FIELDS_JOOMLA_USERNAME_IS_INVALID'));
     }
     $text = JText::_('PLG_FIELDS_JOOMLA_USERNAME_AVAILABLE');
     return $ajax->resolve($text);
 }
Example #21
0
 public function getDanhsach()
 {
     $data = $this->inputData();
     $vName = JRequest::getString('view');
     AdminTochucHelper::addSubmenu($vName);
     AdminTochucHelper::addButton($vName);
     $this->mainframe = JFactory::getApplication();
     $this->option = JRequest::getWord('option');
     $uri = JFactory::getURI();
     $status = $this->mainframe->getUserStateFromRequest($this->option . 'status', 'status', '', 'string');
     $filter_order = $this->mainframe->getUserStateFromRequest($this->option . 'filter_order', 'filter_order', 'name', 'cmd');
     $filter_order_Dir = $this->mainframe->getUserStateFromRequest($this->option . 'filter_order_Dir', 'filter_order_Dir', '', 'word');
     $search = $this->mainframe->getUserStateFromRequest($this->option . 'search', 'search', '', 'string');
     if (strpos($search, '"') !== false) {
         $search = str_replace(array('=', '<'), '', $search);
     }
     $search = JString::strtolower($search);
     if (!in_array(strtoupper($filter_order_Dir), array('ASC', 'DESC'))) {
         $filter_order_Dir = '';
     }
     $javascript = 'onchange="document.adminForm.submit()"';
     $lists['status'] = JHTML::_('select.genericlist', array(array('value' => '', 'text' => '--Trạng thái--'), array('value' => '1', 'text' => 'Sử dụng'), array('value' => '0', 'text' => 'Không sử dụng')), 'status', $javascript . ' class="inputbox" size="1"', 'value', 'text', $status);
     $model = JModelLegacy::getInstance('tochucdang', 'TochucModel');
     $items = $model->listDanhsach($data['table']);
     $totals = $model->getTotal($data['table']);
     $pagination = $model->getPagination($data['table']);
     $lists['order_Dir'] = $filter_order_Dir;
     $lists['order'] = $filter_order;
     $lists['search'] = $search;
     $this->sidebar = JHtmlSidebar::render();
     $this->assignRef('data', $data);
     $this->assignRef('lists', $lists);
     $this->assignRef('items', $items);
     $this->assignRef('pagination', $pagination);
 }
Example #22
0
 function display($tpl = null)
 {
     $option = JRequest::getCmd('option');
     $mainframe = JFactory::getApplication();
     $uri = JFactory::getURI();
     $filter_order = $mainframe->getUserStateFromRequest($option . 's_filter_order', 'filter_order', 's.ordering', 'cmd');
     $filter_order_Dir = $mainframe->getUserStateFromRequest($option . 's_filter_order_Dir', 'filter_order_Dir', '', 'word');
     $search = $mainframe->getUserStateFromRequest($option . 's_search', 'search', '', 'string');
     $search = JString::strtolower($search);
     $items = $this->get('Data');
     $total = $this->get('Total');
     $pagination = $this->get('Pagination');
     // table ordering
     $lists['order_Dir'] = $filter_order_Dir;
     $lists['order'] = $filter_order;
     // search filter
     $lists['search'] = $search;
     $user = JFactory::getUser();
     $this->user = $user;
     $this->lists = $lists;
     $this->items = $items;
     $this->pagination = $pagination;
     $this->request_url = $uri->toString();
     $this->addToolbar();
     parent::display($tpl);
 }
 /**
  * Get conditions for search
  * @param $value
  * @return array
  */
 protected function _getWhere($value)
 {
     if ($this->_isUserExists($value)) {
         return array('tItem.created_by = ' . (int) $value);
     }
     if (!is_array($value)) {
         $value = array($value);
     }
     $conditions = array();
     foreach ($value as $oneValue) {
         $oneValue = JString::trim($oneValue);
         if (empty($oneValue)) {
             continue;
         }
         $userIds = $this->_getUserIdByName($oneValue);
         if (!empty($userIds)) {
             $conditions[] = 'tItem.created_by IN (' . implode(', ', $userIds) . ')';
         }
         $conditions[] = 'tItem.created_by_alias LIKE ' . $this->_db->quote('%' . $oneValue . '%');
     }
     if (!empty($conditions)) {
         return array('( ' . implode(' OR ', $conditions) . ' )');
     }
     return array('tItem.id IN (0)');
 }
Example #24
0
 public function setImage($path, $type = 'thumb')
 {
     CError::assert($path, '', '!empty', __FILE__, __LINE__);
     $db = $this->getDBO();
     // Fix the back quotes
     $path = CString::str_ireplace('\\', '/', $path);
     $type = JString::strtolower($type);
     // Test if the record exists.
     $oldFile = $this->{$type};
     if ($db->getErrorNum()) {
         JError::raiseError(500, $db->stderr());
     }
     if ($oldFile) {
         // File exists, try to remove old files first.
         $oldFile = CString::str_ireplace('/', '/', $oldFile);
         // If old file is default_thumb or default, we should not remove it.
         //
         // Need proper way to test it
         if (!JString::stristr($oldFile, 'group.jpg') && !JString::stristr($oldFile, 'group_thumb.jpg') && !JString::stristr($oldFile, 'default.jpg') && !JString::stristr($oldFile, 'default_thumb.jpg')) {
             jimport('joomla.filesystem.file');
             JFile::delete($oldFile);
         }
     }
     $this->{$type} = $path;
     $this->store();
 }
Example #25
0
 function display()
 {
     global $mainframe;
     $db =& JFactory::getDBO();
     $user =& JFactory::getUser();
     $context = 'com_banners.bannerclient.list.';
     $filter_order = $mainframe->getUserStateFromRequest($context . 'filter_order', 'filter_order', 'a.name', 'cmd');
     $filter_order_Dir = $mainframe->getUserStateFromRequest($context . 'filter_order_Dir', 'filter_order_Dir', '', 'word');
     $search = $mainframe->getUserStateFromRequest($context . 'search', 'search', '', 'string');
     $search = JString::strtolower($search);
     $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
     $limitstart = $mainframe->getUserStateFromRequest($context . 'limitstart', 'limitstart', 0, 'int');
     $where = array();
     if ($search) {
         $where[] = 'LOWER(a.name) LIKE ' . $db->Quote('%' . $db->getEscaped($search, true) . '%', false);
     }
     $where = count($where) ? ' WHERE ' . implode(' AND ', $where) : '';
     $orderby = ' ORDER BY ' . $filter_order . ' ' . $filter_order_Dir . ', a.cid';
     // get the total number of records
     $query = 'SELECT a.*, count(b.bid) AS nbanners, u.name AS editor' . ' FROM #__bannerclient AS a' . ' LEFT JOIN #__banner AS b ON a.cid = b.cid' . ' LEFT JOIN #__users AS u ON u.id = a.checked_out' . $where . ' GROUP BY a.cid' . $orderby;
     $db->setQuery($query);
     $db->query();
     $total = $db->getNumRows();
     jimport('joomla.html.pagination');
     $pageNav = new JPagination($total, $limitstart, $limit);
     $db->setQuery($query, $pageNav->limitstart, $pageNav->limit);
     $rows = $db->loadObjectList();
     // table ordering
     $lists['order_Dir'] = $filter_order_Dir;
     $lists['order'] = $filter_order;
     // search filter
     $lists['search'] = $search;
     require_once JPATH_COMPONENT . DS . 'views' . DS . 'client.php';
     BannersViewClients::clients($rows, $pageNav, $lists);
 }
 function display($tpl = null)
 {
     ## If we want the add/edit form..
     if ($this->getLayout() == 'form') {
         $this->_displayForm($tpl);
         return;
     }
     $db = JFactory::getDBO();
     $mainframe = JFactory::getApplication();
     $filter_scan_result = $mainframe->getUserStateFromRequest('filter_scan_result', 'filter_scan_result', '0', 'cmd');
     $search = $mainframe->getUserStateFromRequest('searchbox', 'searchbox', '', 'string');
     $search = JString::strtolower($search);
     $lists['search'] = $search;
     ## Filling the Array() for doors and make a select list for it.
     $result = array('0' => array('value' => '0', 'text' => JText::_('COM_TICKETMASTER_PLS_SELECT')), '1' => array('value' => '100', 'text' => JText::_('COM_TICKETMASTER_SCAN_SUCCESS')), '2' => array('value' => '101', 'text' => JText::_('COM_TICKETMASTER_SCAN_BLACKLISTED')), '3' => array('value' => '102', 'text' => JText::_('COM_TICKETMASTER_TICKET_WAS_UNPAID')), '4' => array('value' => '103', 'text' => JText::_('COM_TICKETMASTER_TICKET_WAS_SCANNED_BEFORE')), '5' => array('value' => '104', 'text' => JText::_('COM_TICKETMASTER_UNAUTHORIZED_SCANNER')), '6' => array('value' => '105', 'text' => JText::_('COM_TICKETMASTER_NO_BARCODE_FOUND')));
     $lists['result'] = JHTML::_('select.genericList', $result, 'filter_scan_result', ' class="input-medium" ', 'value', 'text', (int) $filter_scan_result);
     ## Model is defined in the controller
     $model = $this->getModel();
     ## Getting the items into a variable
     $items = $this->get('list');
     $pagination = $this->get('pagination');
     $data = $this->get('config');
     $this->assignRef('pagination', $pagination);
     $this->assignRef('lists', $lists);
     $this->assignRef('items', $items);
     $this->assignRef('data', $data);
     parent::display($tpl);
 }
Example #27
0
 function display($tpl = null)
 {
     //initialise variables
     $document =& JFactory::getDocument();
     $db =& JFactory::getDBO();
     $app =& JFactory::getApplication();
     JHTML::_('behavior.tooltip');
     JHTML::_('behavior.modal');
     //get vars
     $filter_order = $app->getUserStateFromRequest('com_eventlist.categoryelement.filter_order', 'filter_order', 'c.ordering', 'cmd');
     $filter_order_Dir = $app->getUserStateFromRequest('com_eventlist.categoryelement.filter_order_Dir', 'filter_order_Dir', '', 'word');
     $filter_state = $app->getUserStateFromRequest('com_eventlist.categoryelement.filter_state', 'filter_state', '*', 'word');
     $search = $app->getUserStateFromRequest('com_eventlist.categoryelement.search', 'search', '', 'string');
     $search = $db->getEscaped(trim(JString::strtolower($search)));
     $template = $app->getTemplate();
     //prepare document
     $document->setTitle(JText::_('SELECT CATEGORY'));
     $document->addStyleSheet('templates/' . $template . '/css/general.css');
     $document->addStyleSheet('components/com_eventlist/assets/css/eventlistbackend.css');
     // Get data from the model
     $rows =& $this->get('Data');
     $pageNav =& $this->get('Pagination');
     //publish unpublished filter
     $lists['state'] = JHTML::_('grid.state', $filter_state);
     // table ordering
     $lists['order_Dir'] = $filter_order_Dir;
     $lists['order'] = $filter_order;
     // search filter
     $lists['search'] = $search;
     //assign data to template
     $this->assignRef('lists', $lists);
     $this->assignRef('rows', $rows);
     $this->assignRef('pageNav', $pageNav);
     parent::display($tpl);
 }
Example #28
0
 /**
  * Parse CBR XML
  * TODO: Sometimes SimpleXML doesn't work, so we used preg_matches
  * @param null $currency
  * @return array|void
  */
 public function _loadData($currency = null)
 {
     if (is_null($this->_curList)) {
         $this->_curList = array();
         $params = array();
         if ((int) $this->config->get('force_date', 1)) {
             $params['date_req'] = date("d/m/Y");
         }
         $xmlString = $this->_loadUrl($this->_apiUrl, $params);
         if (empty($xmlString)) {
             $xmlString = $this->app->jbhttp->url($this->_apiUrl, $params);
             // anti ban
         }
         if (empty($xmlString)) {
             return $this->_curList;
         }
         $xmlString = JString::trim(iconv("WINDOWS-1251", "UTF-8//TRANSLIT", $xmlString));
         preg_match_all('#<Valute(.*?)<\\/Valute>#ius', $xmlString, $out);
         if (!empty($out) && isset($out[1])) {
             foreach ($out[1] as $row) {
                 preg_match("#<Value>(.*?)</Value>#ius", $row, $value);
                 preg_match("#<CharCode>(.*?)</CharCode>#ius", $row, $code);
                 preg_match("#<Nominal>(.*?)</Nominal>#ius", $row, $nominal);
                 $value = $this->_jbmoney->clearValue($value[1]);
                 $nominal = trim(strtolower($nominal[1]));
                 $code = trim(strtolower($code[1]));
                 $this->_curList[$code] = $value / $nominal;
             }
             $this->_curList['rub'] = 1;
         }
         $this->_curList = $this->_normToDefault($this->_curList);
     }
     return $this->_curList;
 }
Example #29
0
 function _buildContentWhere()
 {
     $option = 'com_joomleague';
     $mainframe = JFactory::getApplication();
     $project_id = $mainframe->getUserState($option . 'project');
     $team_id = $mainframe->getUserState($option . 'project_team_id');
     $filter_state = $mainframe->getUserStateFromRequest($option . 'ts_filter_state', 'filter_state', '', 'word');
     $search = $mainframe->getUserStateFromRequest($option . 'ts_search', 'search', '', 'string');
     $search_mode = $mainframe->getUserStateFromRequest($option . 'ts_search_mode', 'search_mode', '', 'string');
     $search = JString::strtolower($search);
     $where = array();
     $where[] = 'ts.projectteam_id=' . $team_id;
     $where[] = "ppl.published = '1'";
     if ($search) {
         if ($search_mode) {
             $where[] = 'LOWER(lastname) LIKE ' . $this->_db->Quote($search . '%');
         } else {
             $where[] = 'LOWER(lastname) LIKE ' . $this->_db->Quote('%' . $search . '%');
         }
     }
     if ($filter_state) {
         if ($filter_state == 'P') {
             $where[] = 'ts.published = 1';
         } elseif ($filter_state == 'U') {
             $where[] = 'ts.published = 0';
         }
     }
     $where = count($where) ? ' WHERE ' . implode(' AND ', $where) : '';
     return $where;
 }
Example #30
0
 public function display()
 {
     jimport('joomla.html.pagination');
     // get application
     $app = Zoo::getApplication();
     // set toolbar items
     $this->joomla->set('JComponentTitle', $app->getToolbarTitle(JText::_('Tags')));
     JToolBarHelper::deleteList();
     ZooHelper::toolbarHelp();
     JHTML::_('behavior.tooltip');
     // get request vars
     $state_prefix = $this->option . '_' . $app->id . '.tags.';
     $filter_order = $this->joomla->getUserStateFromRequest($state_prefix . 'filter_order', 'filter_order', '', 'cmd');
     $filter_order_Dir = $this->joomla->getUserStateFromRequest($state_prefix . 'filter_order_Dir', 'filter_order_Dir', 'desc', 'word');
     $limit = $this->joomla->getUserStateFromRequest('global.list.limit', 'limit', $this->joomla->getCfg('list_limit'), 'int');
     $limitstart = $this->joomla->getUserStateFromRequest($state_prefix . 'limitstart', 'limitstart', 0, 'int');
     $search = $this->joomla->getUserStateFromRequest($state_prefix . 'search', 'search', '', 'string');
     $search = JString::strtolower($search);
     // is filtered ?
     $this->is_filtered = !empty($search);
     // in case limit has been changed, adjust limitstart accordingly
     $limitstart = $limit != 0 ? floor($limitstart / $limit) * $limit : 0;
     // get data
     $filter = $filter_order ? $filter_order . ' ' . $filter_order_Dir : '';
     $this->tags = YTable::getInstance('tag')->getAll($app->id, $search, '', $filter, $limitstart, $limit);
     $count = (int) YTable::getInstance('tag')->count($app->id);
     $this->pagination = new JPagination($count, $limitstart, $limit);
     // table ordering and search filter
     $this->lists['order_Dir'] = $filter_order_Dir;
     $this->lists['order'] = $filter_order;
     $this->lists['search'] = $search;
     // display view
     $this->getView()->display();
 }