/** * @param int $contactid The contact item id */ public static function association($contactid) { // Get the associations $associations = ContactHelper::getAssociations($contactid); foreach ($associations as $tag => $associated) { $associations[$tag] = (int) $associated->id; } // Get the associated contact items $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('c.*'); $query->from('#__contact_details as c'); $query->select('cat.title as category_title'); $query->leftJoin('#__categories as cat ON cat.id=c.catid'); $query->where('c.id IN (' . implode(',', array_values($associations)) . ')'); $query->leftJoin('#__languages as l ON c.language=l.lang_code'); $query->select('l.image'); $query->select('l.title as language_title'); $db->setQuery($query); $items = $db->loadObjectList('id'); // Check for a database error. if ($error = $db->getErrorMsg()) { JError::raiseWarning(500, $error); return false; } // Construct html $text = array(); foreach ($associations as $tag => $associated) { if ($associated != $contactid) { $text[] = JText::sprintf('COM_CONTACT_TIP_ASSOCIATED_LANGUAGE', JHtml::_('image', 'mod_languages/' . $items[$associated]->image . '.gif', $items[$associated]->language_title, array('title' => $items[$associated]->language_title), true), $items[$associated]->name, $items[$associated]->category_title); } } return JHtml::_('tooltip', implode('<br />', $text), JText::_('COM_CONTACT_TIP_ASSOCIATION'), 'admin/icon-16-links.png'); }
/** * Add the page title and toolbar. * * @since 1.6 */ protected function addToolbar() { require_once JPATH_COMPONENT . '/helpers/contact.php'; $canDo = ContactHelper::getActions($this->state->get('filter.category_id')); $user = JFactory::getUser(); JToolBarHelper::title(JText::_('COM_CONTACT_MANAGER_CONTACTS'), 'contact.png'); if ($canDo->get('core.create') || count($user->getAuthorisedCategories('com_contact', 'core.create')) > 0) { JToolBarHelper::addNew('contact.add', 'JTOOLBAR_NEW'); } if ($canDo->get('core.edit') || $canDo->get('core.edit.own')) { JToolBarHelper::editList('contact.edit', 'JTOOLBAR_EDIT'); } if ($canDo->get('core.edit.state')) { JToolBarHelper::divider(); JToolBarHelper::custom('contacts.publish', 'publish.png', 'publish_f2.png', 'JTOOLBAR_PUBLISH', true); JToolBarHelper::custom('contacts.unpublish', 'unpublish.png', 'unpublish_f2.png', 'JTOOLBAR_UNPUBLISH', true); JToolBarHelper::divider(); JToolBarHelper::archiveList('contacts.archive', 'JTOOLBAR_ARCHIVE'); JToolBarHelper::custom('contacts.checkin', 'checkin.png', 'checkin_f2.png', 'JTOOLBAR_CHECKIN', true); } if ($this->state->get('filter.published') == -2 && $canDo->get('core.delete')) { JToolBarHelper::deleteList('', 'contacts.delete', 'JTOOLBAR_EMPTY_TRASH'); JToolBarHelper::divider(); } else { if ($canDo->get('core.edit.state')) { JToolBarHelper::trash('contacts.trash', 'JTOOLBAR_TRASH'); JToolBarHelper::divider(); } } if ($canDo->get('core.admin')) { JToolBarHelper::preferences('com_contact'); JToolBarHelper::divider(); } JToolBarHelper::help('JHELP_COMPONENTS_CONTACTS_CONTACTS'); }
function saveNewField() { require_once JPATH_COMPONENT . '/helpers/contact.php'; $type = JFactory::getApplication()->input->get("type", false); $fieldName = JFactory::getApplication()->input->get("fieldName", false, "string"); $defaultValue = JFactory::getApplication()->input->get("defaultValue", false, "string"); $fieldState = JFactory::getApplication()->input->get("fieldState", false); $fieldGroup = JFactory::getApplication()->input->get("fieldGroup", false); $fieldItems = JFactory::getApplication()->input->get("fieldItems", false, "string"); $fieldRadio = JFactory::getApplication()->input->get("fieldRadio", false); $newGroupName = JFactory::getApplication()->input->get("newGroupName", false); $key = JFactory::getApplication()->input->get("key", false); $response = ContactHelper::saveNewField($type, $fieldName, $defaultValue, $fieldState, $fieldGroup, $fieldItems, $fieldRadio, $newGroupName, $key); //,$b2jGroups echo json_encode($response); exit; }
/** * Add the page title and toolbar. * * @since 1.6 */ protected function addToolbar() { require_once JPATH_COMPONENT . '/helpers/contact.php'; $canDo = ContactHelper::getActions($this->state->get('filter.category_id')); $user = JFactory::getUser(); // Get the toolbar object instance $bar = JToolBar::getInstance('toolbar'); JToolbarHelper::title(JText::_('COM_CONTACT_MANAGER_CONTACTS'), 'contact.png'); if ($canDo->get('core.create') || count($user->getAuthorisedCategories('com_contact', 'core.create')) > 0) { JToolbarHelper::addNew('contact.add'); } if ($canDo->get('core.edit') || $canDo->get('core.edit.own')) { JToolbarHelper::editList('contact.edit'); } if ($canDo->get('core.edit.state')) { JToolbarHelper::publish('contacts.publish', 'JTOOLBAR_PUBLISH', true); JToolbarHelper::unpublish('contacts.unpublish', 'JTOOLBAR_UNPUBLISH', true); JToolbarHelper::archiveList('contacts.archive'); JToolbarHelper::checkin('contacts.checkin'); } if ($this->state->get('filter.published') == -2 && $canDo->get('core.delete')) { JToolbarHelper::deleteList('', 'contacts.delete', 'JTOOLBAR_EMPTY_TRASH'); } elseif ($canDo->get('core.edit.state')) { JToolbarHelper::trash('contacts.trash'); } // Add a batch button if ($user->authorise('core.create', 'com_contacts') && $user->authorise('core.edit', 'com_contacts') && $user->authorise('core.edit.state', 'com_contacts')) { JHtml::_('bootstrap.modal', 'collapseModal'); $title = JText::_('JTOOLBAR_BATCH'); // Instantiate a new JLayoutFile instance and render the batch button $layout = new JLayoutFile('joomla.toolbar.batch'); $dhtml = $layout->render(array('title' => $title)); $bar->appendButton('Custom', $dhtml, 'batch'); } if ($canDo->get('core.admin')) { JToolbarHelper::preferences('com_contact'); } JToolbarHelper::help('JHELP_COMPONENTS_CONTACTS_CONTACTS'); JHtmlSidebar::setAction('index.php?option=com_contact'); JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_published', JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true)); JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_CATEGORY'), 'filter_category_id', JHtml::_('select.options', JHtml::_('category.options', 'com_contact'), 'value', 'text', $this->state->get('filter.category_id'))); JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_ACCESS'), 'filter_access', JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access'))); JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_LANGUAGE'), 'filter_language', JHtml::_('select.options', JHtml::_('contentlanguage.existing', true, true), 'value', 'text', $this->state->get('filter.language'))); JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_TAG'), 'filter_tag', JHtml::_('select.options', JHtml::_('tag.options', true, true), 'value', 'text', $this->state->get('filter.tag'))); }
/** * Method to display a view. * * @param boolean If true, the view output will be cached * @param array An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}. * * @return JController This object to support chaining. * @since 1.5 */ public function display($cachable = false, $urlparams = false) { require_once JPATH_COMPONENT . '/helpers/contact.php'; // Load the submenu. ContactHelper::addSubmenu(JRequest::getCmd('view', 'contacts')); $view = JRequest::getCmd('view', 'contacts'); $layout = JRequest::getCmd('layout', 'default'); $id = JRequest::getInt('id'); // Check for edit form. if ($view == 'contact' && $layout == 'edit' && !$this->checkEditId('com_contact.edit.contact', $id)) { // Somehow the person just went to the form - we don't allow that. $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id)); $this->setMessage($this->getError(), 'error'); $this->setRedirect(JRoute::_('index.php?option=com_contact&view=contacts', false)); return false; } parent::display(); return $this; }
/** * Add the page title and toolbar. * * @since 1.6 */ protected function addToolbar() { JRequest::setVar('hidemainmenu', true); $user = JFactory::getUser(); $userId = $user->get('id'); $isNew = $this->item->id == 0; $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $userId); // Since we don't track these assets at the item level, use the category id. $canDo = ContactHelper::getActions($this->item->catid, 0); JToolBarHelper::title(JText::_('COM_CONTACT_MANAGER_CONTACT'), 'contact.png'); // Build the actions for new and existing records. if ($isNew) { // For new records, check the create permission. if ($isNew && count($user->getAuthorisedCategories('com_contact', 'core.create')) > 0) { JToolBarHelper::apply('contact.apply'); JToolBarHelper::save('contact.save'); JToolBarHelper::save2new('contact.save2new'); } JToolBarHelper::cancel('contact.cancel'); } else { // Can't save the record if it's checked out. if (!$checkedOut) { // Since it's an existing record, check the edit permission, or fall back to edit own if the owner. if ($canDo->get('core.edit') || $canDo->get('core.edit.own') && $this->item->created_by == $userId) { JToolBarHelper::apply('contact.apply'); JToolBarHelper::save('contact.save'); // We can save this record, but check the create permission to see if we can return to make a new one. if ($canDo->get('core.create')) { JToolBarHelper::save2new('contact.save2new'); } } } // If checked out, we can still save if ($canDo->get('core.create')) { JToolBarHelper::save2copy('contact.save2copy'); } JToolBarHelper::cancel('contact.cancel', 'JTOOLBAR_CLOSE'); } JToolBarHelper::divider(); JToolBarHelper::help('JHELP_COMPONENTS_CONTACTS_CONTACTS_EDIT'); }
/** * Display the view. * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return mixed A string if successful, otherwise an Error object. */ public function display($tpl = null) { $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); ContactHelper::addSubmenu('contacts'); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } // Preprocess the list of items to find ordering divisions. // TODO: Complete the ordering stuff with nested sets foreach ($this->items as &$item) { $item->order_up = true; $item->order_dn = true; } $this->addToolbar(); $this->sidebar = JHtmlSidebar::render(); parent::display($tpl); }
/** * Add the page title and toolbar. * * @since 1.6 */ protected function addToolbar() { JRequest::setVar('hidemainmenu', true); $user = JFactory::getUser(); $userId = $user->get('id'); $isNew = $this->item->id == 0; $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $userId); $canDo = ContactHelper::getActions($this->state->get('filter.category_id')); JToolBarHelper::title(JText::_('COM_CONTACT_MANAGER_CONTACT'), 'contact.png'); // Built the actions for new and existing records. if ($isNew) { // For new records, check the create permission. if ($canDo->get('core.create')) { JToolBarHelper::apply('contact.apply', 'JTOOLBAR_APPLY'); JToolBarHelper::save('contact.save', 'JTOOLBAR_SAVE'); JToolBarHelper::custom('contact.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); } JToolBarHelper::cancel('contact.cancel', 'JTOOLBAR_CANCEL'); } else { // Can't save the record if it's checked out. if (!$checkedOut) { // Since it's an existing record, check the edit permission, or fall back to edit own if the owner. if ($canDo->get('core.edit') || $canDo->get('core.edit.own') && $this->item->created_by == $userId) { JToolBarHelper::apply('contact.apply', 'JTOOLBAR_APPLY'); JToolBarHelper::save('contact.save', 'JTOOLBAR_SAVE'); // We can save this record, but check the create permission to see if we can return to make a new one. if ($canDo->get('core.create')) { JToolBarHelper::custom('contact.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); } } } // If checked out, we can still save if ($canDo->get('core.create')) { JToolBarHelper::custom('contact.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); } JToolBarHelper::cancel('contact.cancel', 'JTOOLBAR_CLOSE'); } JToolBarHelper::divider(); JToolBarHelper::help('JHELP_COMPONENTS_CONTACTS_CONTACTS_EDIT'); }
/** * Display the view. * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return mixed A string if successful, otherwise an Error object. */ public function display($tpl = null) { if ($this->getLayout() !== 'modal') { ContactHelper::addSubmenu('contacts'); } $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->filterForm = $this->get('FilterForm'); $this->activeFilters = $this->get('ActiveFilters'); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } // Preprocess the list of items to find ordering divisions. // TODO: Complete the ordering stuff with nested sets foreach ($this->items as &$item) { $item->order_up = true; $item->order_dn = true; } // We don't need toolbar in the modal window. if ($this->getLayout() !== 'modal') { $this->addToolbar(); $this->sidebar = JHtmlSidebar::render(); } else { // In article associations modal we need to remove language filter if forcing a language. // We also need to change the category filter to show show categories with All or the forced language. if ($forcedLanguage = JFactory::getApplication()->input->get('forcedLanguage', '', 'CMD')) { // If the language is forced we can't allow to select the language, so transform the language selector filter into an hidden field. $languageXml = new SimpleXMLElement('<field name="language" type="hidden" default="' . $forcedLanguage . '" />'); $this->filterForm->setField($languageXml, 'filter', true); // Also, unset the active language filter so the search tools is not open by default with this filter. unset($this->activeFilters['language']); // One last changes needed is to change the category filter to just show categories with All language or with the forced language. $this->filterForm->setFieldAttribute('category_id', 'language', '*,' . $forcedLanguage, 'filter'); } } return parent::display($tpl); }
/** * Add the page title and toolbar. * * @since 1.6 */ protected function addToolbar() { require_once JPATH_COMPONENT . '/helpers/contact.php'; $canDo = ContactHelper::getActions(); $user = JFactory::getUser(); // Get the toolbar object instance $bar = JToolBar::getInstance('toolbar'); JToolbarHelper::title(JText::_('COM_B2JCONTACT_MANAGER_CONTACTS'), 'contact.png'); if ($canDo->get('core.create')) { JToolbarHelper::addNew('contact.add'); } if ($canDo->get('core.edit') || $canDo->get('core.edit.own')) { JToolbarHelper::editList('contact.edit'); JToolbarHelper::custom('contacts.duplicate', 'copy.png', 'copy_f2.png', 'JTOOLBAR_DUPLICATE', true); } if ($canDo->get('core.edit.state')) { JToolbarHelper::publish('contacts.publish', 'JTOOLBAR_PUBLISH', true); JToolbarHelper::unpublish('contacts.unpublish', 'JTOOLBAR_UNPUBLISH', true); JToolbarHelper::checkin('contacts.checkin'); } if ($this->state->get('filter.published') == -2 && $canDo->get('core.delete')) { JToolbarHelper::deleteList('', 'contacts.delete', 'JTOOLBAR_EMPTY_TRASH'); } elseif ($canDo->get('core.edit.state')) { JToolbarHelper::trash('contacts.trash'); } // Add a batch button if ($user->authorise('core.edit')) { JHtml::_('bootstrap.modal', 'collapseModal'); $title = JText::_('JTOOLBAR_BATCH'); $dhtml = "<button data-toggle=\"modal\" data-target=\"#collapseModal\" class=\"btn btn-small\">\n\t\t\t\t\t\t<i class=\"icon-checkbox-partial\" title=\"{$title}\"></i>\n\t\t\t\t\t\t{$title}</button>"; //$bar->appendButton('Custom', $dhtml, 'batch'); } if ($canDo->get('core.admin')) { JToolbarHelper::preferences('com_b2jcontact'); } JHtmlSidebar::setAction('index.php?option=com_b2jcontact'); JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_published', JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('archived' => 0)), 'value', 'text', $this->state->get('filter.published'), true)); JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_ACCESS'), 'filter_access', JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access'))); JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_LANGUAGE'), 'filter_language', JHtml::_('select.options', JHtml::_('contentlanguage.existing', true, true), 'value', 'text', $this->state->get('filter.language'))); }
/** * Method to get the associations for a given item * * @param integer $id Id of the item * @param string $view Name of the view * * @return array Array of associations for the item * * @since 3.0 */ public static function getAssociations($id = 0, $view = null) { jimport('helper.route', JPATH_COMPONENT_SITE); $app = JFactory::getApplication(); $jinput = $app->input; $view = is_null($view) ? $jinput->get('view') : $view; $id = empty($id) ? $jinput->getInt('id') : $id; if ($view == 'contact') { if ($id) { $associations = ContactHelper::getAssociations($id); $return = array(); foreach ($associations as $tag => $item) { $return[$tag] = ContactHelperRoute::getContactRoute($item->id, $item->catid, $item->language); } return $return; } } if ($view == 'category' || $view == 'categories') { return self::getCategoryAssociations($id, 'com_contact'); } return array(); }
/** * Display the view */ function display() { // Get the document object. $document =& JFactory::getDocument(); // Set the default view name and format from the Request. $vName = JRequest::getWord('view', 'contacts'); $vFormat = $document->getType(); $lName = JRequest::getWord('layout', 'default'); // Get and render the view. if ($view =& $this->getView($vName, $vFormat)) { // Get the model for the view. $model =& $this->getModel($vName); // Push the model into the view (as default). $view->setModel($model, true); $view->setLayout($lName); // Push document object into the view. $view->assignRef('document', $document); $view->display(); // Load the submenu. require_once JPATH_COMPONENT . DS . 'helpers' . DS . 'contact.php'; ContactHelper::addSubmenu($vName); } }
public static function rendGroup($group) { $groupHtml = '<div id="b2j_group_' . $group->val . '" class="b2jGroup">' . '<div class="control-group">' . '<div class="control-label">' . '<label title="" for="b2jFieldGroup">' . JText::_('COM_B2JCONTACT_DYNAMIC_FIELD_GROUP_TITLE_LBL') . ' *</label>' . '</div>' . '<div class="controls">' . '<input id="" type="text" fieldType="title" fieldKey="' . $group->val . '" value="' . $group->title . '" size="26" name="b2jGroupName" class="">' . '</div>' . '</div>' . '<div class="control-group">' . '<div class="control-label">' . '<label title="" for="b2jFieldGroup">' . JText::_('COM_B2JCONTACT_DYNAMIC_FIELD_GROUP_CLASS_LBL') . '</label>' . '</div>' . '<div class="controls">' . '<input id="" type="text" fieldType="class" fieldKey="' . $group->val . '" value="' . $group->class . '" size="26" name="b2jGroupClass" class="">' . '</div>' . '</div>' . '<div class="control-group">' . '<div class="control-label">' . '<label title="">' . JText::_('COM_B2JCONTACT_DYNAMIC_FIELD_STATE_LBL') . ' *</label>' . '</div>' . '<div class="controls">' . '<select fieldKey="' . $group->val . '" fieldType="state" >'; $options[0]['value'] = '0'; $options[0]['text'] = JText::_('COM_B2JCONTACT_DYNAMIC_FIELD_OPTION_DISABLED_LBL'); $options[1]['value'] = '1'; $options[1]['text'] = JText::_('COM_B2JCONTACT_DYNAMIC_FIELD_OPTION_ENABLE_LBL'); foreach ($options as $option) { $selected = $option['value'] == $group->state ? $selected = 'selected="selected"' : ""; $groupHtml .= '<option value="' . $option['value'] . '" ' . $selected . '>' . $option['text'] . '</option>'; } $groupHtml .= '</select>' . '</div>' . '</div>'; $groupHtml .= ContactHelper::rendButtons("b2jGroup", $group->val); $groupHtml .= '</div>'; return $groupHtml; }
/** * Method to get a single record. * * @param integer $pk The id of the primary key. * * @return mixed Object on success, false on failure. * @since 1.6 */ public function getItem($pk = null) { if ($item = parent::getItem($pk)) { // Convert the params field to an array. $registry = new JRegistry(); $registry->loadString($item->metadata); $item->metadata = $registry->toArray(); } // Load associated contact items $app = JFactory::getApplication(); $assoc = isset($app->item_associations) ? $app->item_associations : 0; if ($assoc) { $item->associations = array(); if ($item->id != null) { $associations = ContactHelper::getAssociations($item->id); foreach ($associations as $tag => $association) { $item->associations[$tag] = $association->id; } } } return $item; }
protected function getInput() { require_once JPATH_COMPONENT . '/helpers/contact.php'; if (!isset($this->value)) { $html = '<input type="hidden" name="' . $this->name . '" id="' . $this->id . '" value=\'' . $this->element['default'] . '\' >'; $items = json_decode($this->element['default']); } else { $html = '<input type="hidden" name="' . $this->name . '" id="' . $this->id . '" value=\'' . $this->value . '\' >'; $items = json_decode($this->value); } $itemID = 0; $data = null; foreach ((array) $this->form as $key => $val) { if ($val instanceof JRegistry) { $data =& $val; break; } } $groupsValue = false; $data = $data->toArray(); if (isset($data['params']['itemgroups'])) { $groupsValue = json_decode($data['params']['itemgroups']); } if (!$groupsValue) { $formfields = $this->form->getFieldset('formfields'); $xmlData = $formfields["jform_params_itemgroups"]->element; $groupsValue = (string) $xmlData['default']; $groupsValue = json_decode($groupsValue); } $gradingGroups = array(); foreach ($groupsValue as $key => $group) { $gradingGroups[$group[0]->ordering] = $group[0]; $gradingGroups[$group[0]->ordering]->val = $key; } ksort($gradingGroups); if ($items) { $fieldsByOrder = array(); foreach ($items as $key => $item) { $fieldsByOrder[$item[0]->b2jFieldOrdering][] = $item[0]; } ksort($fieldsByOrder); $fieldsByGroup = array(); foreach ($fieldsByOrder as $key => $fieldByOrder) { foreach ($fieldByOrder as $item) { $fieldsByGroup[$item->b2jFieldGroup][] = $item; } } } $html .= '<ol class="sortable">'; $groupHtml = ''; $fieldHtml = ''; unset($gradingGroups[0]); foreach ($gradingGroups as $group) { $html .= '<li class="b2j-group" id="group_' . (string) $group->val . '" groupId="' . (string) $group->val . '"> <div><i class="icon-menu"></i><span class="group-name">' . JText::_('COM_B2JCONTACT_DYNAMIC_FIELD_GROUP_LBL') . ': ' . $group->title . '</span><span class="group-action"><a href="#" class="group-edit-btn" isGroup="true" onClick="showEditField(this,' . (string) $group->val . ')">Edit</a> <a href="#" isGroup="true" class="group-delete-btn" onClick="deleteField(this,' . (string) $group->val . ');">Delete</a></span></div>'; $groupHtml .= ContactHelper::rendGroup($group); if (isset($fieldsByGroup[$group->val])) { $html .= '<ol>'; foreach ($fieldsByGroup[$group->val] as $item) { switch ($item->type) { case 'b2jDynamicText': $fieldHtml .= ContactHelper::rendTextField($item, $item->b2jFieldKey, $gradingGroups); $type = JText::_('COM_B2JCONTACT_DYNAMIC_FIELD_TYPE_TEXT'); break; case 'b2jDynamicDropdown': $fieldHtml .= ContactHelper::rendDropdownField($item, $item->b2jFieldKey, $gradingGroups); $type = JText::_('COM_B2JCONTACT_DYNAMIC_FIELD_TYPE_DROPDOWN'); break; case 'b2jDynamicTextarea': $fieldHtml .= ContactHelper::rendTextareaField($item, $item->b2jFieldKey, $gradingGroups); $type = JText::_('COM_B2JCONTACT_DYNAMIC_FIELD_TYPE_TEXT_AREA'); break; case 'b2jDynamicEmail': $fieldHtml .= ContactHelper::rendEmailField($item, $item->b2jFieldKey, $gradingGroups); $type = JText::_('COM_B2JCONTACT_DYNAMIC_FIELD_TYPE_EMAIL'); break; case 'b2jDynamicCheckbox': $fieldHtml .= ContactHelper::rendCheckboxField($item, $item->b2jFieldKey, $gradingGroups); $type = JText::_('COM_B2JCONTACT_DYNAMIC_FIELD_TYPE_CHECK_BOX'); break; case 'b2jDynamicDate': $fieldHtml .= ContactHelper::rendDateField($item, $item->b2jFieldKey, $gradingGroups); $type = JText::_('COM_B2JCONTACT_DYNAMIC_FIELD_TYPE_DATE'); break; case 'b2jDynamicLabel': $fieldHtml .= ContactHelper::rendLabelField($item, $item->b2jFieldKey, $gradingGroups); $type = JText::_('COM_B2JCONTACT_DYNAMIC_FIELD_TYPE_LABEL'); break; default: $fieldHtml .= JText::_('COM_B2JCONTACT_DYNAMIC_FIELD_TYPE_ERROR'); $type = JText::_('COM_B2JCONTACT_DYNAMIC_FIELD_TYPE_ERROR'); break; } $icon = ''; if ($item->type == 'b2jDynamicEmail' && $item->b2jFieldRadio == '1') { $icon = "<span class='email_default'> (Default)</span>"; } $html .= '<li id="item_' . $item->b2jFieldKey . '" class="row' . $item->b2jFieldKey . ' fields" key="' . $item->b2jFieldKey . '" groupId="' . (string) $group->val . '"> <div> <i class="icon-menu"></i> <span class="b2j-dynamic-field-name">' . $item->b2jFieldName . '</span> <span class="b2j-dynamic-field-type">' . $type . $icon . '</span> <span style="float:right;"> <input type="button" class="b2j-dynamic-field-action-links edit" isGroup="false" value="' . JText::_('COM_B2JCONTACT_DYNAMIC_FIELD_EDIT_BTN') . '" onClick="showEditField(this,' . $item->b2jFieldKey . ')"> <input type="button" class="b2j-dynamic-field-action-links delete" isGroup="false" value="' . JText::_('COM_B2JCONTACT_DYNAMIC_FIELD_DELETE_BTN') . '" onClick="deleteField(this,' . $item->b2jFieldKey . ');"> </span> </div> </li>'; } $html .= '</ol>'; } } $html .= '</ol>'; $html .= $fieldHtml; $html .= $groupHtml; $doc = JFactory::$document; $name = $this->element['name'][0]; $script = ' var value = \'' . $this->value . '\'; var hiddenInputId = \'' . $this->id . '\'; if(value==""){ value=new Array(); }else{ value = JSON.parse(value); } for(key in value){ value[key] = value[key][0]; } var name = "' . $name . '"; var id = "' . $this->id . '"; '; $doc->addScriptDeclaration($script); return $html; }