/** * Insert an intro text into the content table * * @param strng $shIntroText * @return boolean, true if success */ function shInsertContent( $pageTitle, $shIntroText) { jimport('joomla.database.table'); try { $catid = Sh404sefHelperCategories::getUncategorizedCat(); if(empty($catid)) { $this->setError( JText::_('COM_SH404SEF_CANNOT_SAVE_404_NO_UNCAT')); return; } $contentTable = JTable::getInstance( 'content'); $content = array( 'title' => $pageTitle, 'alias' => $pageTitle, 'title_alias' => $pageTitle, 'introtext' => $shIntroText, 'state' => 1 , 'catid' => $catid, 'attribs' => '{"menu_image":"-1","show_title":"0","show_section":"0","show_category":"0","show_vote":"0","show_author":"0","show_create_date":"0","show_modify_date":"0","show_pdf_icon":"0","show_print_icon":"0","show_email_icon":"0","pageclass_sfx":""'); $status = $contentTable->save( $content); } catch (Sh404sefExceptionDefault $e) { $status = false; } return $status; }
public function getCategorySlugArray($extension, $id, $whichCat, $useAlias, $insertId, $uncategorizedPath = '', $requestedLanguage = '*', $separator = '') { // special case for the "uncategorised" category $unCat = Sh404sefHelperCategories::getUncategorizedCat($extension); if (!empty($unCat) && $id == $unCat->id) { $slugArray = empty($uncategorizedPath) ? array() : array($uncategorizedPath); return $slugArray; } // regular category, build the path to the cat $separator = empty($separator) ? Sh404sefFactory::getConfig()->replacement : $separator; $pathArray = $this->getCategoryPathArray($extension, $id, $whichCat, $useAlias, $insertId, $requestedLanguage, $separator); $slugArray = array(); foreach ($pathArray as $catObject) { $slugArray[] = $catObject->slug; } return $slugArray; }
/** * Push current error documents content * values into the view for edition */ private function _pushConfigDataErrorDocs() { // get configuration object $sefConfig =& Sh404sefFactory::getConfig(); // push it into to the view $this->assignRef('sefConfig', $sefConfig); // special check for Joomfish 2.0 : must be sure href are not cached in language selection module // otherwise new SEF urls will not be created shDisableJFModuleCaching(); $database =& JFactory::getDBO(); $std_opt = 'class="inputbox" size="2"'; // find about "uncategorized" category $unCat = Sh404sefHelperCategories::getUncategorizedCat(); // get a list of the static content items for 404 page $query = "SELECT id, title" . "\n FROM #__content" . "\n WHERE title != '__404__'" . "\n AND catid = " . intval($unCat->id) . "\n ORDER BY ordering"; $database->setQuery($query); $items = $database->loadObjectList(); $options = array(JHTML::_('select.option', 0, "(" . JText::_('COM_SH404SEF_DEF_404_PAGE') . ")")); //$options[] = JHTML::_('select.option', 9999999, "(Front Page)" ); // 1.2.4.t // assemble menu items to the array foreach ($items as $item) { $options[] = JHTML::_('select.option', $item->id, $item->title); } $lists['page404'] = JHTML::_('select.genericlist', $options, 'page404', 'class="inputbox" size="1"', 'value', 'text', $sefConfig->page404); $sql = 'SELECT id,introtext FROM #__content WHERE `title`="__404__"'; $row = null; $database->setQuery($sql); $row = $database->loadObject(); if (!empty($row) && !empty($row->introtext)) { // V 1.2.4.t $txt404 = $row->introtext; } else { $txt404 = JText::_('COM_SH404SEF_DEF_404_MSG'); } //push params in to view $this->assign('lists', $lists); $this->assign('txt404', $txt404); }