/** * Creates a new or edits and existing user record * @param int The id of the record, 0 if a new entry * @param string The current GET/POST option */ function editContact($edit) { $db =& JFactory::getDBO(); $user =& JFactory::getUser(); $cid = JRequest::getVar('cid', array(0), '', 'array'); $option = JRequest::getCmd('option'); JArrayHelper::toInteger($cid, array(0)); $row =& JTable::getInstance('contact', '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->imagepos = 'top'; $row->ordering = 0; $row->published = 1; } $lists = array(); // build the html select list for ordering $query = 'SELECT ordering AS value, name AS text' . ' FROM #__contact_details' . ' WHERE published >= 0' . ' AND catid = ' . (int) $row->catid . ' ORDER BY ordering'; if ($edit) { $lists['ordering'] = JHTML::_('list.specificordering', $row, $cid[0], $query); } else { $lists['ordering'] = JHTML::_('list.specificordering', $row, '', $query); } // build list of users $lists['user_id'] = JHTML::_('list.users', 'user_id', $row->user_id, 1, NULL, 'name', 0); // build list of categories $lists['catid'] = JHTML::_('list.category', 'catid', 'com_contact_details', intval($row->catid)); // build the html select list for images $lists['image'] = JHTML::_('list.images', 'image', $row->image); // build the html select list for the group access $lists['access'] = JHTML::_('list.accesslevel', $row); // build the html radio buttons for published $lists['published'] = JHTML::_('select.booleanlist', 'published', '', $row->published); // build the html radio buttons for default $lists['default_con'] = JHTML::_('select.booleanlist', 'default_con', '', $row->default_con); // get params definitions $file = JPATH_ADMINISTRATOR . '/components/com_contact/contact_items.xml'; $params = new JParameter($row->params, $file, 'component'); HTML_contact::editcontact($row, $lists, $option, $params); }
/** * Creates a new or edits and existing user record * @param int The id of the record, 0 if a new entry * @param string The current GET/POST option */ function editContact($id, $option) { global $database, $my; global $mosConfig_absolute_path; $row = new mosContact($database); // load the row from the db table $row->load($id); if ($id) { // do stuff for existing records $row->checkout($my->id); } else { // do stuff for new records $row->imagepos = 'top'; $row->ordering = 0; $row->published = 1; } $lists = array(); // build the html select list for ordering $query = "SELECT ordering AS value, name AS text" . "\n FROM #__contact_details" . "\n WHERE published >= 0" . "\n AND catid = '{$row->catid}'" . "\n ORDER BY ordering"; $lists['ordering'] = mosAdminMenus::SpecificOrdering($row, $id, $query, 1); // build list of users $lists['user_id'] = mosAdminMenus::UserSelect('user_id', $row->user_id, 1); // build list of categories $lists['catid'] = mosAdminMenus::ComponentCategory('catid', 'com_contact_details', intval($row->catid)); // build the html select list for images $lists['image'] = mosAdminMenus::Images('image', $row->image); // build the html select list for the group access $lists['access'] = mosAdminMenus::Access($row); // build the html radio buttons for published $lists['published'] = mosHTML::yesnoradioList('published', '', $row->published); // build the html radio buttons for default $lists['default_con'] = mosHTML::yesnoradioList('default_con', '', $row->default_con); // get params definitions $file = $mosConfig_absolute_path . '/administrator/components/com_contact/contact_items.xml'; $params =& new mosAdminParameters($row->params, $file, 'component'); HTML_contact::editcontact($row, $lists, $option, $params); }