/** * Creates a new or edits and existing user record */ function editNewsFeed($edit) { $db =& JFactory::getDBO(); $user =& JFactory::getUser(); $catid = JRequest::getVar('catid', 0, '', 'int'); $cid = JRequest::getVar('cid', array(0), '', 'array'); $option = JRequest::getCmd('option'); JArrayHelper::toInteger($cid, array(0)); $row =& JTable::getInstance('newsfeed', 'Table'); // load the row from the db table if ($edit) { $row->load($cid[0]); } if ($edit) { // do stuff for existing records $row->checkout($user->get('id')); } else { // do stuff for new records $row->ordering = 0; $row->numarticles = 5; $row->cache_time = 3600; $row->published = 1; } // build the html select list for ordering $query = 'SELECT a.ordering AS value, a.name AS text' . ' FROM #__newsfeeds AS a' . ' ORDER BY a.ordering'; if ($edit) { $lists['ordering'] = JHTML::_('list.specificordering', $row, $cid[0], $query); } else { $lists['ordering'] = JHTML::_('list.specificordering', $row, '', $query); } // build list of categories $lists['category'] = JHTML::_('list.category', 'catid', $option, intval($row->catid)); // build the html select list $lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $row->published); HTML_newsfeeds::editNewsFeed($row, $lists, $option); }
/** * Creates a new or edits and existing user record * @param int The id of the user, 0 if a new entry * @param string The current GET/POST option */ function editNewsFeed($id, $option) { global $database, $my; $catid = intval(mosGetParam($_REQUEST, 'catid', 0)); $row = new mosNewsFeed($database); // load the row from the db table $row->load((int) $id); if ($id) { // do stuff for existing records $row->checkout($my->id); } else { // do stuff for new records $row->ordering = 0; $row->numarticles = 5; $row->cache_time = 3600; $row->published = 1; } // build the html select list for ordering $query = "SELECT a.ordering AS value, a.name AS text" . "\n FROM #__newsfeeds AS a" . "\n ORDER BY a.ordering"; $lists['ordering'] = mosAdminMenus::SpecificOrdering($row, $id, $query, 1); // build list of categories $lists['category'] = mosAdminMenus::ComponentCategory('catid', $option, intval($row->catid)); // build the html select list $lists['published'] = mosHTML::yesnoRadioList('published', 'class="inputbox"', $row->published); HTML_newsfeeds::editNewsFeed($row, $lists, $option); }