function getFieldHTML($field, $required) { // it might be some other user (in case of admin is editing profile) $user =& JFactory::getUser(); $tName = $field->value; $templates = XiptHelperJomsocial::getTemplatesList(); $class = $required == 1 ? ' required' : ''; $selectedValue = $this->getTemplateValue($tName, $user->id); // XITODO : format it in proper way $allowToChangeTemplate = XiptHelperProfiletypes::getProfileTypeData(XiptLibProfiletypes::getUserData($user->id), 'allowt'); $allowToChangeTemplate = $allowToChangeTemplate || XiptHelperUtils::isAdmin($user->id); if (!$allowToChangeTemplate) { $html = '<input type="hidden" id="field' . $field->id . '" name="field' . $field->id . '" value="' . $selectedValue . '" />'; $html .= $selectedValue; return $html; } $html = '<select id="field' . $field->id . '" name="field' . $field->id . '" class="hasTip select' . $class . ' inputbox" title="' . $field->name . '::' . htmlentities($field->tips) . '">'; $selectedElement = 0; if (!empty($templates)) { foreach ($templates as $tmpl) { $selected = $tmpl == $selectedValue ? ' selected="selected"' : ''; if (!empty($selected)) { $selectedElement++; } $html .= '<option value="' . $tmpl . '"' . $selected . '>' . $tmpl . '</option>'; } } $html .= '</select>'; $html .= '<span id="errfield' . $field->id . 'msg" style="display:none;"> </span>'; return $html; }
function isApplicable() { $plugin = XiptHelperUtils::getPluginStatus('xi_adminapproval'); if (XIPT_JOOMLA_15) { if ($plugin && $plugin->published == 1) { return false; } } else { if ($plugin && $plugin->enabled == 1) { return false; } } $ptypeArray = XiptHelperProfiletypes::getProfileTypeArray(); foreach ($ptypeArray as $ptype) { if (XiptHelperProfiletypes::getProfileTypeData($ptype, 'approve') == true) { return true; } } return false; }
function fetchElement($name, $value, &$node, $control_name) { /*value contain profiletype id so get watermark from function */ $watermark = XiptHelperProfiletypes::getProfileTypeData($value, 'watermark'); $generatedImage = ''; /*generate image from watermark */ $imagePath = JPATH_ROOT . DS . DEFAULT_DEMOAVATAR; $watermarkPath = JPATH_ROOT . DS . $watermark; $watermarkParams = XiptLibProfiletypes::getParams($value, 'watermarkparams'); if (JFile::exists($imagePath) && JFile::exists($watermarkPath)) { $generatedImage = XiptHelperImage::showWatermarkOverImage($imagePath, $watermarkPath, 'ptype_' . $value, $watermarkParams->get('xiWatermarkPosition')); } if (DS == '\\') { $generatedImage = str_replace('\\', '/', $generatedImage); } $html = ''; if ($generatedImage == false || $generatedImage == '') { $generatedImage = DEFAULT_DEMOAVATAR; } $html .= '<img src="' . JURI::root() . '/' . $generatedImage . '" width="64" height="64" alt="generatedimage" border=10 />'; return $html; }
function showActivity($userid, $newPtype, $oldPtype) { if ($newPtype === $oldPtype) { return; } $ptName = XiptHelperProfiletypes::getProfileTypeData($newPtype, 'name'); $act = new stdClass(); $act->cmd = 'wall.write'; $act->actor = $userid; $act->target = 0; // no target $changePt = XiptText::_('CHANGED_PROFILETYPE_TO'); $act->title = JText::_('{actor}' . $changePt . $ptName); $act->content = ''; $act->app = 'wall'; $act->cid = 0; CFactory::load('libraries', 'activities'); $act->comment_type = 'xipt_community.myaction'; $act->comment_id = CActivities::COMMENT_SELF; $act->like_type = 'xipt_community.myaction'; $act->like_id = CActivities::LIKE_SELF; CActivityStream::add($act); return true; }
function getProfiletypeData($id = 0, $what = 'name') { $val = XiptHelperProfiletypes::getProfileTypeData($id, $what); return $val; }
function getProfileTypeName($id) { //XITODO : Clean ALL / NONE, and cache results if ($id == XIPT_PROFILETYPE_ALL || empty($id)) { return XiptText::_("ALL"); } if ($id == XIPT_PROFILETYPE_NONE) { return XiptText::_("NONE"); } return XiptHelperProfiletypes::getProfileTypeData($id, 'name'); }