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


PHP JUDirectoryHelper::getListingSubmitType方法代码示例

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


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

示例1: 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


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