当前位置: 首页>>代码示例>>PHP>>正文


PHP JUDirectoryHelper::getListingById方法代码示例

本文整理汇总了PHP中JUDirectoryHelper::getListingById方法的典型用法代码示例。如果您正苦于以下问题:PHP JUDirectoryHelper::getListingById方法的具体用法?PHP JUDirectoryHelper::getListingById怎么用?PHP JUDirectoryHelper::getListingById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JUDirectoryHelper的用法示例。


在下文中一共展示了JUDirectoryHelper::getListingById方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _getAssetParentId

 protected function _getAssetParentId(JTable $table = null, $id = null)
 {
     $assetId = null;
     if (isset($this->cat_id) && $this->cat_id) {
         $cat_id = $this->cat_id;
     } elseif ($this->id) {
         $cat_id = JUDirectoryHelper::getListingById($this->id)->cat_id;
     }
     if ($cat_id) {
         $query = $this->_db->getQuery(true);
         $query->select($this->_db->quoteName('asset_id'));
         $query->from($this->_db->quoteName('#__judirectory_categories'));
         $query->where($this->_db->quoteName('id') . ' = ' . $cat_id);
         $this->_db->setQuery($query);
         if ($result = $this->_db->loadResult()) {
             $assetId = (int) $result;
         }
     }
     if ($assetId === null) {
         $query = $this->_db->getQuery(true);
         $query->select($this->_db->quoteName('id'));
         $query->from($this->_db->quoteName('#__assets'));
         $query->where($this->_db->quoteName('name') . ' = ' . $this->_db->quote('com_judirectory'));
         $this->_db->setQuery($query);
         if ($result = $this->_db->loadResult()) {
             $assetId = (int) $result;
         }
     }
     if ($assetId) {
         return $assetId;
     } else {
         return parent::_getAssetParentId($table, $id);
     }
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:34,代码来源:listing.php

示例2: back

 public function back()
 {
     $app = JFactory::getApplication();
     $listing_id = $app->input->getInt('listing_id', 0);
     $cat_id = JUDirectoryFrontHelperCategory::getRootCategory()->id;
     if ($listing_id) {
         $listingObj = JUDirectoryHelper::getListingById($listing_id);
         if (isset($listingObj->cat_id) && $listingObj->cat_id) {
             $cat_id = $listingObj->cat_id;
         }
     }
     $this->setRedirect("index.php?option=com_judirectory&view=listcats&cat_id={$cat_id}");
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:13,代码来源:comments.php

示例3: getInput

 public function getInput()
 {
     $db = JFactory::getDbo();
     $groups = array();
     $app = JFactory::getApplication();
     $appendInherit = '';
     if ($app->input->get("view") == "listing") {
         if ($this->form->getValue("id")) {
             $listing = JUDirectoryHelper::getListingById($this->form->getValue("id"));
             $appendInherit = "(" . $this->calculatorInheritStyle($listing->cat_id) . ")";
         }
     } else {
         if ($this->form->getValue("parent_id")) {
             $appendInherit = "(" . $this->calculatorInheritStyle($this->form->getValue("parent_id")) . ")";
         }
     }
     $appendDefault = "(" . $this->getStyle() . ")";
     $groups['inherit'] = array();
     $groups['inherit']['id'] = $this->id . '_inherit';
     $groups['inherit']['text'] = '---' . JText::_('COM_JUDIRECTORY_INHERIT') . '---';
     $groups['inherit']['items'] = array();
     $groups['inherit']['items'][] = JHtml::_('select.option', '-2', JText::_('COM_JUDIRECTORY_DEFAULT') . ' ' . $appendDefault);
     $groups['inherit']['items'][] = JHtml::_('select.option', '-1', JText::_('COM_JUDIRECTORY_INHERIT') . ' ' . $appendInherit);
     $query = $db->getQuery(true);
     $query->select('style.*');
     $query->select('plg.title AS template_title, plg.folder');
     $query->from('#__judirectory_template_styles AS style');
     $query->join('', '#__judirectory_templates AS tpl ON tpl.id = style.template_id');
     $query->join('', '#__judirectory_plugins AS plg ON plg.id = tpl.plugin_id');
     $query->where('style.lft > 0');
     $query->order('style.lft ASC');
     $db->setQuery($query);
     $styles = $db->loadObjectList();
     for ($i = 0, $n = count($styles); $i < $n; $i++) {
         $styles[$i]->text = str_repeat('- ', $styles[$i]->level - 1) . $styles[$i]->title . " [ " . $styles[$i]->template_title . " ]";
     }
     $groups['style'] = array();
     $groups['style']['id'] = 'template_style';
     $groups['style']['text'] = JText::_('COM_JUDIRECTORY_TEMPLATE_STYLES');
     $groups['style']['items'] = array();
     foreach ($styles as $style) {
         $groups['style']['items'][] = JHtml::_('select.option', $style->id, $style->text);
     }
     $html = JHtml::_('select.groupedlist', $groups, $this->name, array('id' => $this->id, 'group.id' => 'id', 'list.attr' => "", 'list.select' => $this->value));
     return $html;
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:46,代码来源:componenttemplatestyle.php

示例4: display

 public function display($tpl = null)
 {
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode('<br />', $errors));
         return false;
     }
     $this->form = $this->get('Form');
     $this->item = $this->get('Item');
     $this->model = $this->getModel();
     $this->app = JFactory::getApplication();
     $cat_id = $this->item->cat_id ? $this->item->cat_id : $this->app->input->get('cat_id');
     $this->params = JUDirectoryHelper::getParams(null, $this->item->id);
     if ($cat_id == JUDirectoryFrontHelperCategory::getRootCategory()->id && !$this->params->get('allow_add_listing_to_root', 0)) {
         JError::raiseError(500, JText::_('COM_JUDIRECTORY_CAN_NOT_ADD_LISTING_TO_ROOT_CATEGORY'));
         return false;
     }
     if ($tempListing = JUDirectoryHelper::getTempListing($this->item->id)) {
         $editPendingListingLink = '<a href="index.php?option=com_judirectory&task=document.edit&approve=1&id=' . $tempListing->id . '">' . $tempListing->title . '</a>';
         JError::raiseNotice('', JText::sprintf('COM_JUDIRECTORY_THIS_LISTING_HAS_PENDING_LISTING_X_PLEASE_APPROVE_PENDING_LISTING_FIRST', $editPendingListingLink));
     }
     if ($this->item->approved < 0) {
         $oriListingId = abs($this->item->approved);
         $oriListingObj = JUDirectoryHelper::getListingById($oriListingId);
         $editOriDocLink = '<a href="index.php?option=com_judirectory&task=document.edit&id=' . $oriListingId . '">' . $oriListingObj->title . '</a>';
         JError::raiseNotice('', JText::sprintf('COM_JUDIRECTORY_ORIGINAL_LISTING_X', $editOriDocLink));
     }
     $this->script = $this->get('Script');
     $this->plugins = $this->get('Plugins');
     $this->fieldLocations = $this->get('FieldLocations');
     $this->fieldsetDetails = $this->model->getCoreFields('details');
     $this->fieldsetPublishing = $this->model->getCoreFields('publishing');
     $this->fieldsetTemplateStyleAndLayout = $this->model->getCoreFields('template_style');
     $this->fieldsetMetadata = $this->model->getCoreFields('metadata');
     $this->fieldCatid = JUDirectoryFrontHelperField::getField('cat_id', $this->item);
     $this->fieldGallery = $this->get('GalleryField');
     $this->extraFields = $this->get('ExtraFields');
     $this->fieldsData = $this->app->getUserState("com_judirectory.edit.listing.fieldsdata", array());
     $this->relatedListings = $this->get('RelatedListings');
     $this->canDo = JUDirectoryHelper::getActions('com_judirectory', 'category', $this->item->cat_id);
     $this->addToolBar();
     $this->setDocument();
     parent::display($tpl);
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:43,代码来源:view.html.php

示例5: getInput

 protected function getInput()
 {
     $hint = $this->translateHint ? JText::_($this->hint) : $this->hint;
     $size = !empty($this->size) ? ' size="' . $this->size . '"' : '';
     $maxLength = !empty($this->maxLength) ? ' maxlength="' . $this->maxLength . '"' : '';
     $class = !empty($this->class) ? ' class="' . $this->class . '"' : '';
     $readonly = $this->readonly ? ' readonly' : '';
     $disabled = $this->disabled ? ' disabled' : '';
     $required = $this->required ? ' required aria-required="true"' : '';
     $hint = $hint ? ' placeholder="' . $hint . '"' : '';
     $autocomplete = !$this->autocomplete ? ' autocomplete="off"' : ' autocomplete="' . $this->autocomplete . '"';
     $autocomplete = $autocomplete == ' autocomplete="on"' ? '' : $autocomplete;
     $autofocus = $this->autofocus ? ' autofocus' : '';
     $spellcheck = $this->spellcheck ? '' : ' spellcheck="false"';
     $pattern = !empty($this->pattern) ? ' pattern="' . $this->pattern . '"' : '';
     $inputmode = !empty($this->inputmode) ? ' inputmode="' . $this->inputmode . '"' : '';
     $dirname = !empty($this->dirname) ? ' dirname="' . $this->dirname . '"' : '';
     $onchange = !empty($this->onchange) ? ' onchange="' . $this->onchange . '"' : '';
     $listingObject = JUDirectoryHelper::getListingById($this->value);
     $listingLink = JRoute::_('index.php?option=com_judirectory&amp;task=listing.edit&amp;id=' . $listingObject->id);
     $html[] = '<div class="btn"><a href="' . $listingLink . '" target="_blank">' . $listingObject->title . '</a></div>';
     $html[] = '<input type="hidden" name="' . $this->name . '" id="' . $this->id . '"' . $dirname . ' value="' . htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '"' . $class . $size . $disabled . $readonly . $hint . $onchange . $maxLength . $required . $autocomplete . $autofocus . $spellcheck . $inputmode . $pattern . ' />';
     return implode($html);
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:24,代码来源:commentlisting.php

示例6: getCurrentTemplateStyle

 public static function getCurrentTemplateStyle($view = '', $id = null)
 {
     $app = JFactory::getApplication();
     $jInput = $app->input;
     if (!$view) {
         $view = $jInput->getString('view', '');
     }
     if ($jInput->getString('option', '') != 'com_judirectory') {
         $view = '';
     }
     if (!$id) {
         switch ($view) {
             case 'form':
                 $id = $jInput->getInt('id', 0);
                 $rootCategory = JUDirectoryFrontHelperCategory::getRootCategory();
                 $cat_id = $jInput->getInt('cat_id', $rootCategory->id);
                 break;
             case 'listing':
                 $id = $jInput->getInt('id', 0);
                 break;
             case 'category':
                 $rootCategory = JUDirectoryFrontHelperCategory::getRootCategory();
                 $id = $jInput->getInt('id', $rootCategory->id);
                 break;
         }
     }
     switch ($view) {
         case 'form':
             if ($id) {
                 $templateStyleObject = self::getTemplateStyleOfListing($id);
                 $listingObject = JUDirectoryHelper::getListingById($id);
                 $templateStyleObject->params = self::getTemplateStyleParams($templateStyleObject->id, $listingObject->template_params);
             } else {
                 $templateStyleObject = self::getTemplateStyleOfCategory($cat_id);
                 $categoryObject = JUDirectoryHelper::getCategoryById($cat_id);
                 $templateStyleObject->params = self::getTemplateStyleParams($templateStyleObject->id, $categoryObject->template_params);
             }
             break;
         case 'listing':
             $templateStyleObject = self::getTemplateStyleOfListing($id);
             $listingObject = JUDirectoryHelper::getListingById($id);
             $templateStyleObject->params = self::getTemplateStyleParams($templateStyleObject->id, $listingObject->template_params);
             break;
         case 'category':
             $templateStyleObject = self::getTemplateStyleOfCategory($id);
             $categoryObject = JUDirectoryHelper::getCategoryById($id);
             $templateStyleObject->params = self::getTemplateStyleParams($templateStyleObject->id, $categoryObject->template_params);
             break;
         default:
             $templateStyleObject = self::getDefaultTemplateStyle();
             $templateStyleObject->params = self::getTemplateStyleParams($templateStyleObject->id);
             break;
     }
     return $templateStyleObject;
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:55,代码来源:template.php

示例7: onCopy

 public function onCopy($toListingId, &$fieldsData = array())
 {
     $db = JFactory::getDbo();
     if ($this->listing->image && strpos($this->listing->image, "default/") === false) {
         $ori_image_name = $this->listing->image;
         $new_image_name = $toListingId . substr($ori_image_name, strpos($ori_image_name, '_'));
         $query = "UPDATE #__judirectory_listings SET image = '" . $new_image_name . "' WHERE id=" . $toListingId;
         $db->setQuery($query);
         $db->execute();
         $image_directory = JPATH_ROOT . "/" . JUDirectoryFrontHelper::getDirectory("listing_image_directory", "media/com_judirectory/images/listing/");
         if (JFile::exists($image_directory . $ori_image_name)) {
             JFile::copy($image_directory . $ori_image_name, $image_directory . $new_image_name);
         }
         if (JFile::exists($image_directory . "original/" . $ori_image_name)) {
             JFile::copy($image_directory . "original/" . $ori_image_name, $image_directory . "original/" . $new_image_name);
         }
     }
     if ($this->listing_id && isset($fieldsData[$this->id])) {
         $toListingObject = JUDirectoryHelper::getListingById($toListingId);
         $fieldsData[$this->id] = $toListingObject->image;
     }
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:22,代码来源:core_image.php

示例8: getMainCategoryId

 public static function getMainCategoryId($listingId, $resetCache = false)
 {
     $listingObj = JUDirectoryHelper::getListingById($listingId, $resetCache);
     if (is_object($listingObj)) {
         return $listingObj->cat_id;
     }
     return null;
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:8,代码来源:category.php

示例9: getListingSubmitType

 public function getListingSubmitType($listingId, $listingObject = null, $isNew = null)
 {
     if (!is_null($isNew)) {
         if ($isNew) {
             return 'submit';
         }
     }
     if ($listingId == 0) {
         return 'submit';
     }
     if (!is_object($listingObject)) {
         $listingObject = JUDirectoryHelper::getListingById($listingId);
     }
     if ($listingObject->approved == 0) {
         return 'submit';
     } else {
         return 'edit';
     }
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:19,代码来源:listing.php

示例10: getListingDisplayParams

 public static function getListingDisplayParams($listing_id)
 {
     if (!$listing_id) {
         return null;
     }
     $storeId = md5(__METHOD__ . "::{$listing_id}");
     if (!isset(self::$cache[$storeId])) {
         $params = JUDirectoryHelper::getParams(null, $listing_id);
         $global_display_params = $params->get('display_params');
         $global_listing_display_object = isset($global_display_params->listing) ? $global_display_params->listing : array();
         $global_listing_display_params = new JRegistry($global_listing_display_object);
         $listingObj = JUDirectoryHelper::getListingById($listing_id);
         $listing_params = $listingObj->params;
         if ($listing_params) {
             $listing_params = json_decode($listing_params);
             $listing_display_params = $listing_params->display_params;
             if ($listing_display_params) {
                 $global_listing_display_params = JUDirectoryFrontHelperField::mergeFieldOptions($global_listing_display_params->toObject(), $listing_display_params);
                 unset($listing_display_params->fields);
                 foreach ($listing_display_params as $option => $value) {
                     if ($value == '-2') {
                         unset($listing_display_params->{$option});
                     }
                 }
                 $global_listing_display_params->loadObject($listing_display_params);
             }
         }
         self::$cache[$storeId] = $global_listing_display_params;
     }
     return self::$cache[$storeId];
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:31,代码来源:listing.php

示例11: getInput

 public function getInput($fieldValue = null)
 {
     if (!$this->isPublished()) {
         return "";
     }
     if (JUDirectoryHelper::getListingSubmitType($this->listing_id) == 'submit' && $this->canSubmit() || JUDirectoryHelper::getListingSubmitType($this->listing_id) == 'edit' && $this->canEdit()) {
         $disabled = false;
     } else {
         $disabled = true;
     }
     $document = JFactory::getDocument();
     $rootCat = JUDirectoryFrontHelperCategory::getRootCategory();
     JText::script('COM_JUDIRECTORY_TOTAL_CATS_OVER_MAXIMUM_N_CATS');
     JText::script('COM_JUDIRECTORY_CATEGORY_X_ALREADY_EXIST');
     $app = JFactory::getApplication();
     // getParams by cat_id if possible
     if (isset($this->listing) && $this->listing->cat_id) {
         $params = JUDirectoryHelper::getParams($this->listing->cat_id);
     } else {
         $params = JUDirectoryHelper::getParams(null, $this->listing_id);
     }
     $db = JFactory::getDbo();
     $listingId = $this->listing_id;
     $listingObject = JUDirectoryHelper::getListingById($listingId);
     $secondaryCatIds = $secondaryCatIdsStr = "";
     // Edit listing, but not valid data -> $fieldValue = user selected categories
     if ($fieldValue && !empty($fieldValue['main'])) {
         $categoryId = (int) $fieldValue['main'];
         if ($fieldValue['secondary']) {
             $secondaryCatIdsStr = $fieldValue['secondary'];
             $secondaryCatIds = explode(",", $secondaryCatIdsStr);
         }
         $query = $db->getQuery(true);
         $query->select("c.id, c.parent_id");
         $query->from("#__judirectory_categories AS c");
         $query->select("field_group.id AS fieldgroup_id, field_group.name AS fieldgroup_name");
         $query->join("LEFT", "#__judirectory_fields_groups AS field_group ON (field_group.id = c.fieldgroup_id AND field_group.published = 1)");
         $query->where("c.id = " . $categoryId);
         $db->setQuery($query);
         $mainCategory = $db->loadObject();
     } elseif ($listingId) {
         $categories = $this->value;
         foreach ($categories as $category) {
             if ($category->main == 1) {
                 $mainCategory = $category;
                 $query = $db->getQuery(true);
                 $query->select("field_group.id, field_group.name");
                 $query->from("#__judirectory_fields_groups AS field_group");
                 $query->join("", "#__judirectory_categories AS c on c.fieldgroup_id = field_group.id");
                 $query->where("c.id = " . $mainCategory->id);
                 $query->where("field_group.published = 1");
                 $db->setQuery($query);
                 $fieldGroup = $db->loadObject();
                 if (is_object($fieldGroup)) {
                     $mainCategory->fieldgroup_name = $fieldGroup->name;
                     $mainCategory->fieldgroup_id = $fieldGroup->id;
                 } else {
                     $mainCategory->fieldgroup_name = null;
                     $mainCategory->fieldgroup_id = null;
                 }
             } else {
                 $secondaryCatIds[] = $category->id;
             }
         }
         if ($secondaryCatIds) {
             $secondaryCatIdsStr = implode(",", $secondaryCatIds);
         }
     } elseif ($app->input->getInt('cat_id')) {
         $categoryId = $app->input->getInt('cat_id');
         $mainCategory = JUDirectoryHelper::getCategoryById($categoryId);
         $query = "SELECT id, name FROM #__judirectory_fields_groups WHERE id= " . $mainCategory->fieldgroup_id . " AND published = 1";
         $db->setQuery($query);
         $fieldGroup = $db->loadObject();
         if (is_object($fieldGroup)) {
             $mainCategory->fieldgroup_name = $fieldGroup->name;
             $mainCategory->fieldgroup_id = $fieldGroup->id;
         } else {
             $mainCategory->fieldgroup_name = null;
             $mainCategory->fieldgroup_id = null;
         }
     } else {
         $mainCategory = new stdClass();
         $mainCategory->id = '';
         $mainCategory->parent_id = $rootCat->id;
         $mainCategory->fieldgroup_name = null;
         $mainCategory->fieldgroup_id = null;
     }
     $document->addStyleSheet(JUri::root() . "components/com_judirectory/fields/" . $this->folder . "/core_categories.css");
     if (!$disabled) {
         $document->addScript(JUri::root() . "components/com_judirectory/fields/" . $this->folder . "/core_categories.js");
         if (JUDirectoryHelper::isJoomla3x()) {
             $jsIsJoomla3x = 1;
         } else {
             $jsIsJoomla3x = 0;
         }
         $script = "jQuery(document).ready(function(\$){\n\t\t\t\t\t\t\t\t\$('.category_selection').listingChangeCategory({\n\t\t\t\t\t\t\t\t\tlisting_id: '" . $listingId . "',\n\t\t\t\t\t\t\t\t\tis_joomla_3x: '" . $jsIsJoomla3x . "',\n\t\t\t\t\t\t\t\t\tmain_cat_id: '" . $mainCategory->id . "',\n\t\t\t\t\t\t\t\t\tfieldgroup_id: '" . $mainCategory->fieldgroup_id . "',\n\t\t\t\t\t\t\t\t\tfieldgroup_name : '" . $mainCategory->fieldgroup_name . "',\n\t\t\t\t\t\t\t\t\tmax_cats : " . (int) $params->get("max_cats_per_listing", 0) . "\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t});";
         $document->addScriptDeclaration($script);
     }
     $this->addAttribute("class", "categories", "input");
     $this->addAttribute("class", $this->getInputClass(), "input");
//.........这里部分代码省略.........
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:101,代码来源:core_categories.php

示例12: getInput

 protected function getInput()
 {
     $clientId = $this->element['client_id'];
     if (is_null($clientId) && $this->form instanceof JForm) {
         $clientId = $this->form->getValue('client_id');
     }
     $clientId = (int) $clientId;
     $client = JApplicationHelper::getClientInfo($clientId);
     $extn = (string) $this->element['extension'];
     if (empty($extn) && $this->form instanceof JForm) {
         $extn = $this->form->getValue('extension');
     }
     $extn = preg_replace('#\\W#', '', $extn);
     $template = (string) $this->element['template'];
     $template = preg_replace('#\\W#', '', $template);
     if ($this->form instanceof JForm) {
         $template_style_id = $this->form->getValue('template_style_id');
     }
     $template_style_id = preg_replace('#\\W#', '', $template_style_id);
     $view = (string) $this->element['view'];
     $view = preg_replace('#\\W#', '', $view);
     if ($extn && $view && $client) {
         $lang = JFactory::getLanguage();
         $lang->load($extn . '.sys', JPATH_ADMINISTRATOR, null, false, false) || $lang->load($extn . '.sys', JPATH_ADMINISTRATOR . '/components/' . $extn, null, false, false) || $lang->load($extn . '.sys', JPATH_ADMINISTRATOR, $lang->getDefault(), false, false) || $lang->load($extn . '.sys', JPATH_ADMINISTRATOR . '/components/' . $extn, $lang->getDefault(), false, false);
         $db = JFactory::getDbo();
         $query = $db->getQuery(true);
         $query->select('e.element, e.name');
         $query->from('#__extensions AS e');
         $query->where('e.client_id = ' . (int) $clientId);
         $query->where('e.type = ' . $db->quote('template'));
         $query->where('e.enabled = 1');
         if ($template) {
             $query->where('e.element = ' . $db->quote($template));
         }
         if ($template_style_id) {
             $query->join('LEFT', '#__template_styles AS s ON s.template=e.element');
             $query->where('s.id=' . (int) $template_style_id);
         }
         $db->setQuery($query);
         $templates = $db->loadObjectList('element');
         if ($db->getErrorNum()) {
             JError::raiseWarning(500, $db->getErrorMsg());
         }
         $component_path = JPath::clean($client->path . '/components/' . $extn . '/views/' . $view . '/tmpl');
         $component_layouts = array();
         $groups = array();
         $items = array();
         if ($this->element['useinherit']) {
             $groups['inherit'] = array();
             $groups['inherit']['id'] = $this->id . '_inherit';
             $groups['inherit']['text'] = '---' . JText::_('COM_JUDIRECTORY_INHERIT') . '---';
             $groups['inherit']['items'] = array();
         }
         if (is_dir($component_path) && ($component_layouts = JFolder::files($component_path, '^[^_]*\\.xml$', false, true))) {
             $groups['_'] = array();
             $groups['_']['id'] = $this->id . '__';
             $groups['_']['text'] = JText::sprintf('JOPTION_FROM_COMPONENT');
             $groups['_']['items'] = array();
             foreach ($component_layouts as $i => $file) {
                 if (!($xml = simplexml_load_file($file))) {
                     unset($component_layouts[$i]);
                     continue;
                 }
                 if (!($menu = $xml->xpath('layout[1]'))) {
                     unset($component_layouts[$i]);
                     continue;
                 }
                 $menu = $menu[0];
                 $value = JFile::stripext(JFile::getName($file));
                 $component_layouts[$i] = $value;
                 $text = isset($menu['option']) ? JText::_($menu['option']) : (isset($menu['title']) ? JText::_($menu['title']) : $value);
                 $groups['_']['items'][] = JHtml::_('select.option', '_:' . $value, $text);
                 $items['_'][$value] = $text;
             }
         }
         $attr = $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : '';
         if ($this->element['useinherit']) {
             $appendInherit = "";
             $app = JFactory::getApplication();
             if ($app->input->get('view', '') == "listing" && $this->form->getValue("id")) {
                 $listing = JUDirectoryHelper::getListingById($this->form->getValue("id"));
                 if ($listing) {
                     $appendInherit = $this->calculatorInheritLayout($items, $listing->cat_id);
                 }
             } elseif ($app->input->get('view', '') == "category") {
                 if ($this->form->getValue("parent_id")) {
                     $appendInherit = $this->calculatorInheritLayout($items, $this->form->getValue("parent_id"));
                 }
             }
             $appendGlodbal = $this->getLayout($items);
             $groups['inherit']['items'][] = JHtml::_('select.option', '-2', 'Global config ' . $appendGlodbal);
             $groups['inherit']['items'][] = JHtml::_('select.option', '-1', 'Inherit category ' . $appendInherit);
         }
         $selected = array($this->value);
         return JHtml::_('select.groupedlist', $groups, $this->name, array('id' => $this->id, 'group.id' => 'id', 'list.attr' => $attr, 'list.select' => $selected));
     } else {
         return '';
     }
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:99,代码来源:listinglayout.php

示例13: updateRating

 public function updateRating($data)
 {
     $user = JFactory::getUser();
     $created = JFactory::getDate()->toSql();
     $criteriaArray = isset($data['criteria_array']) ? $data['criteria_array'] : array();
     $listingId = $data['listing_id'];
     $commentId = $data['comment_id'];
     $ratingObj = $this->getRating($listingId, $commentId);
     $ratingId = $ratingObj->id;
     $ratingScoreOld = $ratingObj->score;
     $ratingScoreNew = JUDirectoryFrontHelperRating::calculateRatingScore($data, $listingId, $criteriaArray);
     $dataRating = array('id' => $ratingId, 'user_id' => $user->id, 'comment_id' => $commentId, 'score' => $ratingScoreNew, 'created' => $created, 'listing_id' => $listingId);
     JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_judirectory/tables');
     $ratingTable = JTable::getInstance('Rating', 'JUDirectoryTable');
     $ratingTable->bind($dataRating);
     if (!$ratingTable->check()) {
         return false;
     }
     $ratingStore = $ratingTable->store();
     if (!$ratingStore) {
         return false;
     }
     if ($ratingStore && count($criteriaArray) > 0) {
         $oldCriteriaIdArr = $this->getCriteriasId($ratingId);
         $criteriaIdArr = array();
         foreach ($criteriaArray as $criteria) {
             $criteriaIdArr[] = $criteria->id;
         }
         $flagUpdate = false;
         if (count(array_diff($criteriaIdArr, $oldCriteriaIdArr)) == 0) {
             $flagUpdate = true;
         }
         if ($flagUpdate == false) {
             $this->deleteCriteriasByRatingId($ratingId);
         }
         foreach ($criteriaArray as $criteria) {
             if ($flagUpdate == true) {
                 $this->updateCriteriaValue($ratingId, $criteria->id, $criteria->value);
             } else {
                 JUDirectoryMultiRating::insertCriteriaValue($ratingId, $criteria->id, $criteria->value);
             }
         }
     }
     $listingItem = JUDirectoryHelper::getListingById($listingId);
     $rating = ($listingItem->rating * $listingItem->total_votes + $ratingScoreNew - $ratingScoreOld) / $listingItem->total_votes;
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $query->update('#__judirectory_listings');
     $query->set('rating = ' . $rating);
     $query->where('id = ' . $listingId);
     $db->setQuery($query);
     $db->execute();
     $session = JFactory::getSession();
     $timeNow = JFactory::getDate()->toSql();
     $timeNowStamp = strtotime($timeNow);
     $inputCookie = JFactory::getApplication()->input->cookie;
     $config = JFactory::getConfig();
     $cookie_domain = $config->get('cookie_domain', '');
     $cookie_path = $config->get('cookie_path', '/');
     $inputCookie->set('judir-listing-rated-' . $listingId, $timeNowStamp, time() + 864000, $cookie_path, $cookie_domain);
     $session->set('judir-listing-rated-' . $listingId, $timeNowStamp);
     $logData = array('user_id' => $user->id, 'event' => 'listing.rate', 'item_id' => $listingId, 'listing_id' => $listingId, 'value' => $ratingScoreNew, 'reference' => $ratingTable->id);
     JUDirectoryFrontHelperLog::addLog($logData);
     return true;
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:65,代码来源:listing.php

示例14: appendDataToListingObjList

 public static function appendDataToListingObjList(&$listingObjectList, $params, $usingForMod = false)
 {
     if (is_array($listingObjectList) && count($listingObjectList)) {
         $user = JFactory::getUser();
         foreach ($listingObjectList as $listingObject) {
             JUDirectoryHelper::getListingById($listingObject->id, false, $listingObject);
             $listingObject->params = JUDirectoryFrontHelperListing::getListingDisplayParams($listingObject->id);
             if (!$user->get('guest')) {
                 $canEditListing = JUDirectoryFrontHelperPermission::canEditListing($listingObject->id);
                 $canEditStateListing = JUDirectoryFrontHelperPermission::canEditStateListing($listingObject);
                 $canDeleteListing = JUDirectoryFrontHelperPermission::canDeleteListing($listingObject->id);
                 $listingObject->params->set('access-edit', $canEditListing);
                 $listingObject->params->set('access-edit-state', $canEditStateListing);
                 $listingObject->params->set('access-delete', $canDeleteListing);
             }
             if ($listingObject->published != 1) {
                 $listingObject->label_unpublished = true;
             } else {
                 $listingObject->label_unpublished = false;
             }
             $listingObject->label_pending = false;
             $nowDate = JFactory::getDate()->toSql();
             if (intval($listingObject->publish_up) > 0) {
                 if (strtotime($listingObject->publish_up) > strtotime($nowDate)) {
                     $listingObject->label_pending = true;
                 }
             }
             $listingObject->label_expired = false;
             if (intval($listingObject->publish_down) > 0) {
                 if (intval($listingObject->publish_up) > 0) {
                     if (strtotime($listingObject->publish_up) <= strtotime($nowDate)) {
                         if (strtotime($listingObject->publish_down) < strtotime($nowDate)) {
                             $listingObject->label_expired = true;
                         }
                     }
                 } else {
                     if (strtotime($listingObject->publish_down) < strtotime($nowDate)) {
                         $listingObject->label_expired = true;
                     }
                 }
             }
             if ($params->get('show_new_label', 1) && JUDirectoryFrontHelper::isWithinXDays($listingObject->publish_up, $params->get('num_day_to_show_as_new', 10))) {
                 $listingObject->label_new = true;
             } else {
                 $listingObject->label_new = false;
             }
             if ($params->get('show_updated_label', 1) && JUDirectoryFrontHelper::isWithinXDays($listingObject->updated, $params->get('num_day_to_show_as_updated', 10))) {
                 $listingObject->label_updated = true;
             } else {
                 $listingObject->label_updated = false;
             }
             if ($params->get('show_hot_label', 1) && JUDirectoryFrontHelperListing::checkHotListing($listingObject->publish_up, $params->get('num_hit_per_day_to_be_hot', 100), $listingObject->hits)) {
                 $listingObject->label_hot = true;
             } else {
                 $listingObject->label_hot = false;
             }
             if ($params->get('show_featured_label', 1) && $listingObject->featured) {
                 $listingObject->label_featured = true;
             } else {
                 $listingObject->label_featured = false;
             }
         }
     }
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:64,代码来源:helper.php

示例15: getListingSegment

 public static function getListingSegment($listingId, &$query, $params)
 {
     if (isset($query['Itemid'])) {
         unset($query['Itemid']);
     }
     $fullPathListing = $params->get('sef_listing_full_path', 0);
     $listingObject = JUDirectoryHelper::getListingById($listingId);
     $mainCategoryId = $listingObject->cat_id;
     $segment = JUDirectoryHelperRoute::getCategorySegment($mainCategoryId, $query, $fullPathListing);
     $segment[] = $listingId . ":" . (isset($listingObject->alias) ? $listingObject->alias : '');
     return $segment;
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:12,代码来源:route.php


注:本文中的JUDirectoryHelper::getListingById方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。