/** * Private method to set the toolbar for this view * * @access private * * @return null **/ function setToolBar() { // Set the titlebar text JToolBarHelper::title(XiptText::_('PROFILE_FIELDS'), 'profilefields'); // Add the necessary buttons JToolBarHelper::back('Home', 'index.php?option=com_xipt'); }
function save($post = null) { if ($post === null) { $post = JRequest::get('post'); } $menuid = isset($post['id']) ? $post['id'] : 0; $otherMenuid = isset($post['menuIds']) ? $post['menuIds'] : array(); $menuPtype = isset($post['profileTypes']) ? $post['profileTypes'] : array(); $allTypes = XiptHelperProfiletypes::getProfileTypeArray(); $model = $this->getModel(); // menuid is also selected in otherMenuid then no need to add if (!in_array($menuid, $otherMenuid)) { array_push($otherMenuid, $menuid); } //remove all rows related to specific menu id foreach ($otherMenuid as $id) { $model->delete(array('menuid' => $id)); } $msg = XiptText::_('MENU_SAVED'); $link = XiptRoute::_('index.php?option=com_xipt&view=jstoolbar', false); $this->setRedirect($link, $msg); //if all selected, return true if (array_diff($allTypes, $menuPtype) == array()) { return true; } $ptypesToChange = array_diff($allTypes, $menuPtype); foreach ($ptypesToChange as $type) { foreach ($otherMenuid as $id) { if ($this->getModel()->save(array('menuid' => $id, 'profiletype' => $type)) == false) { return false; } } } return true; }
function aclAjaxBlock($msg) { $objResponse = new JAXResponse(); $title = XiptText::_('CC PROFILE VIDEO'); $objResponse->addScriptCall('cWindowShow', '', $title, 430, 80); return parent::aclAjaxBlock($msg, $objResponse); }
function getFieldHTML($field, $required) { $html = ''; $pID = $field->value; $class = $required == 1 ? ' required' : ''; $disabled = ''; if ($this->_view === 'register') { // get pType from registration session OR defaultPType $pID = XiptFactory::getPluginHandler()->getRegistrationPType(); $html = '<input type="hidden" id="field' . $field->id . '" name="field' . $field->id . '" value="' . $pID . '" />'; $pName = XiptLibProfiletypes::getProfiletypeName($pID); $html .= $pName; return $html; } // it might be some other user (in case of admin is editing profile) $user = JFactory::getUser(); $userid = $user->id; if (!(int) $pID) { $pID = XiptLibProfiletypes::getUserData($userid, 'PROFILETYPE'); XiptError::assert($pID, XiptText::_("USERID {$pID} DOES_NOT_EXIST"), XiptError::ERROR); } $visiblePT = XiptLibProfiletypes::getProfiletypeArray(array('visible' => 1)); $allowToChangePType = $this->_params->get('allow_user_to_change_ptype_after_reg', 0); $allowToChangePType = $allowToChangePType && array_key_exists($pID, $visiblePT) || XiptHelperUtils::isAdmin($user->id); //if not allowed then show disabled view of ptype if ($allowToChangePType == false) { $pName = XiptLibProfiletypes::getProfileTypeName($pID); $pName = $pName; $html = '<input type="hidden" id="field' . $field->id . '" name="field' . $field->id . '" value="' . $pID . '" />'; return $html . $pName; } $mainframe = JFactory::getApplication(); if ($mainframe->isAdmin() == true || XiptHelperUtils::isAdmin($user->id)) { $filter = array('published' => 1); } else { $filter = array('published' => 1, 'visible' => 1); } // user can change profiletype, add information $pTypes = XiptLibProfiletypes::getProfiletypeArray($filter); $html = '<select id="field' . $field->id . '" name="field' . $field->id . '" ' . $disabled . ' class="hasTip select' . $class . ' inputbox" title="' . $field->name . '::' . htmlentities($field->tips) . '">'; $selectedElement = 0; if (!empty($pTypes)) { foreach ($pTypes as $pType) { $selected = $pType->id == $pID ? ' selected="selected"' : ''; if (!empty($selected)) { $selectedElement++; } $html .= '<option value="' . $pType->id . '"' . $selected . '>' . $pType->name . '</option>'; } } $html .= '</select>'; $html .= '<span id="errfield' . $field->id . 'msg" style="display:none;"> </span>'; return $html; }
function getEventcategoryHTML($name, $value, $control_name = 'params', $reqnone = false, $reqall = false) { $required = '1'; $html = ''; $class = $required == 1 ? ' required' : ''; $options = $this->getEventcategory(); $html .= '<select id="' . $control_name . '[' . $name . ']" name="' . $control_name . '[' . $name . ']" title="' . "Select Group Category" . '">'; if ($reqall) { $selected = JString::trim(0) == $value ? ' selected="true"' : ''; $html .= '<option value="' . 0 . '"' . $selected . '>' . XiptText::_("ALL") . '</option>'; } if ($reqnone) { $selected = JString::trim(-1) == $value ? ' selected="true"' : ''; $html .= '<option value="' . -1 . '"' . $selected . '>' . XiptText::_("NONE") . '</option>'; } foreach ($options as $op) { $option = $op->name; $id = $op->id; $selected = JString::trim($id) == $value ? ' selected="true"' : ''; $html .= '<option value="' . $id . '"' . $selected . '>' . $option . '</option>'; } $html .= '</select>'; $html .= '<span id="errprofiletypemsg" style="display: none;"> </span>'; return $html; }
function setToolBar() { JToolBarHelper::title(XiptText::_('SETTINGS'), 'settings'); JToolBarHelper::back('Home', 'index.php?option=com_xipt'); JToolBarHelper::divider(); JToolBarHelper::save('save', 'COM_XIPT_SAVE'); }
function getFieldsHtml($name, $value, $control_name) { $fields = self::getJomsocialProfileFields(array('published' => 1)); $html = ''; if (empty($fields)) { $html = "<div style=\"text-align: center; padding: 5px; \">" . XiptText::_('THERE_ARE_NO_PARAMETERS_FOR_THIS_ITEM') . "</div>"; return $html; } $html .= "<table width='100%' class='paramlist admintable' cellspacing='1'>"; $html .= "<tr class='title'>"; $html .= "<th width='30%'>" . XiptText::_('FIELD_NAME') . "</th>"; $html .= '<tr>'; $i = 0; foreach ($fields as $f) { ++$i; if ($f->type != 'group') { $html .= "<td class='paramlist_value'>" . $f->name . "</td>"; $profiletypeFieldHtml = $this->buildProfileTypes($name, $value, $control_name, $f->id); $html .= "<td class='paramlist_value'>" . $profiletypeFieldHtml . "</td>"; } $html .= "</tr>"; } $html .= "</table>"; return $html; }
/** * Private method to set the toolbar for this view * * @access private * * @return null **/ function setToolBar() { // Set the titlebar text JToolBarHelper::title(XiptText::_('CONTROL_PANEL'), 'xipt'); //JToolBarHelper::back('Home' , 'index.php?option=com_xipt'); //JToolBarHelper::custom('aboutus','aboutus','',XiptText::_('ABOUT US'),0,0); }
function display($save = '', $pt = 0) { //trigger event $dispatcher = JDispatcher::getInstance(); $dispatcher->trigger('onBeforeProfileTypeSelection'); // check for session // if does not exist redirect user to community page XiptHelperProfiletypes::checkSessionForProfileType(); //If not allowed to select PT for user then return if (XiptFactory::getSettings('show_ptype_during_reg') == 0) { $selectedProfiletypeID = XiptLibProfiletypes::getDefaultProfiletype(); XiptHelperProfiletypes::setProfileTypeInSession($selectedProfiletypeID); } // do some validation for visibility and publish of ptype if (JRequest::getVar('save', $save, 'POST') != '') { $selectedProfiletypeID = JRequest::getVar('profiletypes', $pt, 'POST'); if (XiptLibProfiletypes::validateProfiletype($selectedProfiletypeID, array('published' => 1, 'visible' => 1)) == false) { $msg = XiptText::_('INVALID_PROFILE_TYPE_SELECTED'); $link = XiptRoute::_('index.php?option=com_xipt&view=registration', false); $this->setRedirect($link, $msg); } $dispatcher->trigger('onAfterProfileTypeSelection', array(&$selectedProfiletypeID)); return true; } // Get the view $this->getView()->display(); }
function getMessage() { if ($this->isRequired()) { $requiredSetup['done'] = true; $requiredSetup['message'] = XiptText::_("UPGRADE_JOMSOCIAL_VERSION_1_8_x_IS_SUPPORTED"); return $requiredSetup; } }
function getMessage() { if ($this->isRequired()) { $requiredSetup['done'] = true; $requiredSetup['message'] = XiptText::_("WATER_MARKING_IS_NOT_ENABLED_IN_SETTINGS_BUT_ENABLE_FOR_PROFILE_TYPES"); return $requiredSetup; } }
function getMessage() { if ($this->isRequired()) { $requiredSetup['done'] = true; $requiredSetup['message'] = XiptText::_("INSTALL_OR_ENABLE_ADMIN_APPROVAL_PLUGIN"); return $requiredSetup; } }
public static function getPlanName($planid) { //check existance of plan if (!self::isPlanExists($planid)) { return XiptText::_('INVALID_PLAN'); } $result = self::getPlan($planid); return $result->name; }
function getMessage() { $requiredSetup = array(); if ($this->isRequired()) { $link = XiptRoute::_("index.php?option=com_xipt&view=setup&task=doApply&name=ptmigration", false); $requiredSetup['message'] = '<a href="' . $link . '">' . XiptText::_('PLEASE_CLICK_HERE_TO_MIGRATE_JS_MULTIPROFILES') . '</a>'; $requiredSetup['done'] = false; } return $requiredSetup; }
function save($post = null) { if ($post === null) { $post = JRequest::get('post', JREQUEST_ALLOWRAW); } $save = $this->getModel()->saveParams($post['settings'], 'settings', 'params'); XiptError::assert($save, XiptText::_('ERROR_IN_SAVING_SETTINGS'), XiptError::WARNING); $msg = XiptText::_('SETTINGS_SAVED'); $this->setRedirect("index.php?option=com_xipt&view=settings", $msg); return true; }
public static function getInstance() { $suffix = JString::stristr(XiptHelperJomsocial::get_js_version(), 2.0) ? "Js20" : "Js18"; $classname = "XiptFieldsTemplates" . JString::ucfirst($suffix); if (class_exists($classname, true) === false) { XiptError::raiseError(__CLASS__ . '.' . __LINE__, XiptText::_("{$className} : CLASS_NOT_FOUND")); return false; } $instance = new $classname(); return $instance; }
function _checkedOut(&$row, $overlib = 1) { $hover = ''; if ($overlib) { $text = addslashes(htmlspecialchars($row->checked_out)); $date = XiHTML::_('date', $row->checked_out_time, XiptText::_('DATE_FORMAT_LC1')); $time = XiHTML::_('date', $row->checked_out_time, '%H:%M'); $hover = '<span class="editlinktip hasTip" title="' . XiText::_('CHECKED_OUT') . '::' . $text . '<br />' . $date . '<br />' . $time . '">'; } $checked = $hover . '<img src="images/checked_out.png"/></span>'; return $checked; }
function getProfileTypeArray($menuid) { XiptError::assert($menuid, XiptText::_("MENU_ID_CANNOT_BE_NULL"), XiptError::ERROR); $results = XiptFactory::getInstance('jstoolbar', 'model')->getProfileTypes($menuid); if (empty($results)) { return array(XIPT_PROFILETYPE_ALL); } $allTypes = XiptHelperProfiletypes::getProfileTypeArray(); // array_values is user to arrange the array from index 0, //array_diff uses index starting from 1 return array_values(array_diff($allTypes, $results)); }
function getMessage() { $requiredSetup = array(); if ($this->isRequired()) { $link = XiptRoute::_("index.php?option=com_xipt&view=setup&task=doApply&name=payplans", false); $requiredSetup['message'] = '<a href="' . $link . '">' . XiptText::_("PLEASE_CLICK_HERE_TO_CREATE_APPS_IN_PAYPLANS") . '</a>'; $requiredSetup['done'] = false; } else { $requiredSetup['message'] = XiptText::_("PAYPLANS_IS_ALREADY_IN_SYNC"); $requiredSetup['done'] = true; } return $requiredSetup; }
function getMessage() { $requiredSetup = array(); if ($this->isRequired()) { $link = XiptRoute::_("index.php?option=com_xipt&view=setup&task=doApply&name=aecmi", false); $requiredSetup['message'] = '<a href="' . $link . '">' . XiptText::_("PLEASE_CLICK_HERE_TO_INSTALL_JSPT_MI_INTO_AEC") . '</a>'; $requiredSetup['done'] = false; } else { $requiredSetup['message'] = XiptText::_("AEC_MI_ALREADY_THERE"); $requiredSetup['done'] = true; } return $requiredSetup; }
function getProfileTypeArray($fid, $for) { XiptError::assert($fid, XiptText::_("PROFILEFIELD_ID_CAN_NOT_BE_NULL"), XiptError::ERROR); //Load all profiletypes for the field $results = XiptFactory::getInstance('profilefields', 'model')->getProfileTypes($fid, $for); if (empty($results)) { return array(XIPT_PROFILETYPE_ALL); } $allTypes = XiptHelperProfiletypes::getProfileTypeArray(); // array_values is user to arrange the array from index 0, //array_diff uses index starting from 1 return array_values(array_diff($allTypes, $results)); }
function getMessage() { $requiredSetup = array(); if ($this->isRequired()) { $link = XiptRoute::_("index.php?option=com_xipt&view=setup&task=doApply&name=createprofiletypes", false); $requiredSetup['message'] = '<a href="' . $link . '">' . XiptText::_("PLEASE_CLICK_HERE_TO_CREATE_PROFILETYPES") . '</a>'; $requiredSetup['done'] = false; } else { $requiredSetup['message'] = XiptText::_("PROFILETYPE_VALIDATION_SUCCESSFULL"); $requiredSetup['done'] = true; } return $requiredSetup; }
function getMessage() { $requiredSetup = array(); if ($this->isRequired()) { $link = XiptRoute::_("index.php?option=com_xipt&view=setup&task=doApply&name=defaultprofiletype", false); $requiredSetup['message'] = '<a href="' . $link . '">' . XiptText::_("PLEASE_CLICK_HERE_TO_SET_DEFAULT_PROFILETYPE") . '</a>'; $requiredSetup['done'] = false; } else { $requiredSetup['message'] = XiptText::_("DEFAULT_PROFILETYPE_EXIST"); $requiredSetup['done'] = true; } return $requiredSetup; }
function unhook() { //get all files required for setup $setupNames = XiptSetupHelper::getOrderedRules(); foreach ($setupNames as $setup) { //get object of class $setupObject = XiptFactory::getSetupRule($setup['name']); $setupObject->doRevert(); } $msg = XiptText::_('UNHOOKED_SUCCESSFULLY'); $this->setRedirect(XiptRoute::_("index.php?option=com_xipt&view=setup&task=display", false), $msg); return true; }
function getMessage() { $requiredSetup = array(); if ($this->isRequired()) { $link = XiptRoute::_("index.php?option=com_xipt&view=setup&task=doApply&name=xiptplugin", false); $requiredSetup['message'] = '<a href="' . $link . '">' . XiptText::_("PLEASE_CLICK_HERE_TO_ENABLE_ESSENTIAL_SETTINGS") . '</a>'; $requiredSetup['done'] = false; } else { $requiredSetup['message'] = XiptText::_("ESSENTIALS_SETTINGS_DONE"); $requiredSetup['done'] = true; } return $requiredSetup; }
function fetchElement($name, $value, &$node, $control_name) { $positions = array(); $positions[] = JHTML::_('select.option', 'tl', XiptText::_('TOP_LEFT')); $positions[] = JHTML::_('select.option', 'tr', XiptText::_('TOP_RIGHT')); $positions[] = JHTML::_('select.option', 'bl', XiptText::_('BOTTOM_LEFT')); $positions[] = JHTML::_('select.option', 'br', XiptText::_('BOTTOM_RIGHT')); $positions[] = JHTML::_('select.option', 'lt', XiptText::_('LEFT_TOP')); $positions[] = JHTML::_('select.option', 'lb', XiptText::_('LEFT_BOTTOM')); $positions[] = JHTML::_('select.option', 'rt', XiptText::_('RIGHT_TOP')); $positions[] = JHTML::_('select.option', 'rb', XiptText::_('RIGHT_BOTTOM')); $html = JHTML::_('select.genericlist', $positions, $control_name . '[' . $name . ']', null, 'value', 'text', $value); return $html; }
function getFieldData($value = 0) { $pID = $value; if (!$pID) { //get value from profiletype field from xipt_users table //not required to get data from getUser() fn b'coz we call this fn in //getViewableprofile only. $userid = JRequest::getVar('userid', 0); XiptError::assert($userid, XiptText::_("USERID {$userid} DOES_NOT_EXIST"), XiptError::ERROR); $pID = XiptLibProfiletypes::getUserData($userid, 'PROFILETYPE'); } $pName = XiptLibProfiletypes::getProfiletypeName($pID); return $pName; }
function getFieldsForProfiletype(&$fields, $selectedProfiletypeID, $from, $notSelectedFields = null) { XiptError::assert($selectedProfiletypeID, XiptText::_("SELECTED_PROFILETYPE_DOES_NOT_EXIST"), XiptError::ERROR); $task = JRequest::getVar('task', ''); if ($notSelectedFields === null) { $categories = XiptHelperProfilefields::getProfileFieldCategories(); foreach ($categories as $catIndex => $catInfo) { $catName = $catInfo['name']; $notSelectedFields[$catName] = $this->getNotSelectedFieldForProfiletype($selectedProfiletypeID, $catIndex); } } $count = count($fields); for ($i = 0; $i < $count; $i++) { $field =& $fields[$i]; if (is_object($field)) { $fieldId = $field->id; } else { $fieldId = $field['id']; } if (in_array($fieldId, $notSelectedFields['ALLOWED'])) { unset($fields[$i]); continue; } if (in_array($fieldId, $notSelectedFields['REQUIRED'])) { if (is_object($field)) { $field->required = 0; } else { $field['required'] = 0; } } if (in_array($fieldId, $notSelectedFields['VISIBLE']) && $from === 'getViewableProfile') { unset($fields[$i]); continue; } if (in_array($fieldId, $notSelectedFields['EDITABLE_AFTER_REG']) && $from === 'getEditableProfile' && JFactory::getApplication()->isAdmin() == false) { unset($fields[$i]); continue; } if (in_array($fieldId, $notSelectedFields['EDITABLE_DURING_REG']) && $from != 'getViewableProfile' && $from != 'getEditableProfile' && $task != 'advancesearch') { unset($fields[$i]); continue; } if (in_array($fieldId, $notSelectedFields['ADVANCE_SEARCHABLE']) && $from === '_loadAllFields' && $task === 'advancesearch') { unset($fields[$i]); } } $fields = array_values($fields); return true; }
function reset($id = 0) { //XITODO : what to do if invalid id comes $id = JRequest::getVar('profileId', $id); $pModel = $this->getModel(); // Try to save configurations $save = $pModel->save(array('params' => ''), $id); if (XiptError::assert($save, XiptText::_('UNABLE_TO_RESET_PROFILETYPE_INTO_DATABASE_PLEASE_ENSURE_THAT_THE_TABLE_JOS_XIPT_PROFILETYPES_EXISTS'), XiptError::WARNING) == false) { return false; } $link = XiptRoute::_('index.php?option=com_xipt&view=configuration', false); $msg = XiptText::_('PROFILETYPE_HAS_BEEN_RESET'); $this->setRedirect($link, $msg); return true; }
function getInput() { $none = new stdClass(); $none->id = -1; $none->name = XiptText::_('none'); // get array of all visible profile types (std-class) $pTypeArray = XiptLibProfiletypes::getProfiletypeArray(array('published' => 1, 'visible' => 1)); //add multiselect option $attr = $this->multiple ? ' multiple="multiple"' : ''; if ($attr == null) { // add none option in profile-type array array_unshift($pTypeArray, $none); } return JHTML::_('select.genericlist', $pTypeArray, $this->name, $attr, 'id', 'name', $this->value); }