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 getPtypeDisplayPageForFacebook(&$response, $addhtml) { //XITODO : trigger an API Event to add something to templates, or modify $profiletypes array // e.g. : I want to patch description. with some extra information $filter = array('published' => 1, 'visible' => 1); $allProfileTypes = XiptLibProfiletypes::getProfiletypeArray($filter); $defaultPType = XiptLibProfiletypes::getDefaultProfiletype(); $selectedPT = $defaultPType; $params = XiptFactory::getSettings('', 0); $showAsRadio = $params->get('jspt_fb_show_radio', false); ob_start(); include JPATH_ROOT . DS . 'components' . DS . 'com_xipt' . DS . 'views' . DS . 'registration' . DS . 'tmpl' . DS . 'facebook.php'; $contents = ob_get_contents(); ob_end_clean(); $html = ''; $html .= $addhtml; $html .= $contents; $buttons = ''; if ($showAsRadio) { $response->addScriptCall('cWindowResize', PTYPE_POPUP_WINDOW_HEIGHT_RADIO, PTYPE_POPUP_WINDOW_WIDTH_RADIO); $buttons = '<input type="button" value="' . XiptText::_('NEXT') . '" class="button" onclick="cWindowShow(jax.call(\'community\',\'connect,ajaxShowNewUserForm\', + jQuery(\'[name=profiletypes]:checked\').val()), \'\', 450, 200); return false;" />'; } else { $response->addScriptCall('cWindowResize', PTYPE_POPUP_WINDOW_HEIGHT_SELECT, PTYPE_POPUP_WINDOW_WIDTH_SELECT); $buttons = '<input type="button" value="' . XiptText::_('NEXT') . '" class="button" onclick="cWindowShow(jax.call(\'community\',\'connect,ajaxShowNewUserForm\', + jQuery(\'#profiletypes\').val()), \'\', 450, 200); return false;" />'; } $response->addScriptCall('joms.jQuery("#cwin_logo").html("' . XiptText::_('CHOOSE_PROFILE_TYPE') . '");'); $response->addAssign('cWindowContent', 'innerHTML', $html); $response->addScriptCall('cWindowActions', $buttons); $response->sendResponse(); }
function __construct() { $this->_mainframe = JFactory::getApplication(); $this->_task = JRequest::getVar('task', 0); $this->_view = JRequest::getVar('view', 0); $this->_params = XiptFactory::getSettings('', 0); }
function isRequired() { $defaultProfiletypeID = XiptFactory::getSettings('defaultProfiletypeID', 0); if ($defaultProfiletypeID && XiptLibProfiletypes::validateProfiletype($defaultProfiletypeID)) { return false; } return true; }
function getReturnURL() { $regType = XiptFactory::getSettings('user_reg'); if ($regType === 'jomsocial') { return XiPTRoute::_('index.php?option=com_community&view=register', false); } if (!XIPT_JOOMLA_15) { return XiPTRoute::_('index.php?option=com_users&view=registration', false); } return XiPTRoute::_('index.php?option=com_user&view=register', false); }
function isRequired() { $params = XiptFactory::getSettings(); $integrate_with = $params->get('integrate_with', 0); $subscription_integrate = $params->get('subscription_integrate', 0); if ($integrate_with == 'aec' || $subscription_integrate == false) { return false; } $app = $this->getXiptApps(); if ($app) { return false; } return true; }
function isRequired() { $ptypeArray = XiptHelperProfiletypes::getProfileTypeArray(); $globalWM = XiptFactory::getSettings('show_watermark', 0); if ($globalWM) { return false; } foreach ($ptypeArray as $ptype) { $watermarkParams = XiptLibProfiletypes::getParams($ptype, 'watermarkparams'); if ($watermarkParams->get('enableWaterMark', 0) == true) { return true; } } return false; }
public static function getPayplansMessage() { $data = self::getProfiletypeInfoFromPayplans(); $msgOption = XiptFactory::getSettings('subscription_message', 'b'); $pTypeName = XiptLibProfiletypes::getProfiletypeName($data['profiletype']); if ($msgOption === 'pl') { return XiptText::sprintf('COM_XIPT_ALREADY_SELECTED_PLAN_AS_ONLYPLAN', $data['plan']); } if ($msgOption === 'pt') { return XiptText::sprintf('COM_XIPT_ALREADY_SELECTED_PLAN_AS_ONLY_PTYPE', $pTypeName); } if ($msgOption === 'no') { return false; } return XiptText::sprintf('COM_XIPT_ALREADY_SELECTED_PLAN_AS_BOTH', $data['plan'], $pTypeName); }
function isRequired() { $params = XiptFactory::getSettings('', 0); $defaultProfiletypeID = $params->get('defaultProfiletypeID', 0); if (!$defaultProfiletypeID) { JFactory::getApplication()->enqueueMessage(XiptText::_("FIRST_SELECT_THE_DEFAULT_PROFILE_TYPE")); return false; } $PTFieldId = XiptHelperJomsocial::getFieldId(PROFILETYPE_CUSTOM_FIELD_CODE); $TMFieldId = XiptHelperJomsocial::getFieldId(TEMPLATE_CUSTOM_FIELD_CODE); // we need first these fields to be exist if (!($PTFieldId && $TMFieldId)) { return true; } $result = $this->getUsertoSyncUp(); if (empty($result)) { return false; } return true; }
function display($tpl = null) { // if user is already register then return to different URL $userId = JFactory::getUser()->id; if ($userId) { $redirectUrl = XiptRoute::_('index.php?option=com_community&view=profile', false); $msg = XiptText::_('YOU_ARE_ALREADY_REGISTERED_NEED_NOT_TO_REGISTER_AGAIN'); JFactory::getApplication()->redirect($redirectUrl, $msg); } // refine it, if empty will add default pType $allProfileTypes = array(); $seletedPTypeID = JRequest::getVar('ptypeid', ''); //TODO : trigger an API Event to add something to templates, or modify $profiletypes array // e.g. : I want to patch description. with some extra information $filter = array('published' => 1, 'visible' => 1); $allProfileTypes = XiptLibProfiletypes::getProfiletypeArray($filter); $this->assign('allProfileTypes', $allProfileTypes); $this->assign('selectedPT', $seletedPTypeID); $params = XiptFactory::getSettings('', 0); $this->assign('showAsRadio', $params->get('jspt_show_radio', true)); parent::display($tpl); }
function checkAclApplicable(&$data) { $aecExists = XiptLibAec::isAecExists(); $subs_integrate = XiptFactory::getSettings('subscription_integrate', 0); $integrate_with = XiptFactory::getSettings('integrate_with', 0); // pType already selected if (!$subs_integrate || $integrate_with != 'aec' || !$aecExists) { return false; } $user = JFactory::getUser(); if (!$user->id) { return false; } if ('com_acctexp' == $data['option']) { return false; } if ($data['option'] == 'com_user') { return false; } if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') { return false; } return true; }
$css = JURI::root() . 'components/com_xipt/assets/style.css'; $document = JFactory::getDocument(); $document->addStyleSheet($css); ?> <form action="<?php echo XiptRoute::_('index.php?option=com_xipt&view=registration&reset=true', false); ?> " method="post" name="ptypeForm"> <div class="registerProfileType"> <h3 id="Title"><?php echo XiptText::_('CHOOSE_PROFILE_TYPE'); ?> </h3> <?php if (XiptFactory::getSettings('jspt_show_radio')) { echo $this->loadTemplate('click'); } else { echo $this->loadTemplate('select'); } ?> </div> <div class="clr" title="Next"></div> <input type="hidden" name="view" value="registration" /> <input type="hidden" name="task" value="" /> <input type="hidden" name="option" value="com_xipt" /> <input type="hidden" name="boxchecked" value="0" /> <?php echo JHTML::_('form.token'); ?> </form>
/** * The user data have been saved. * We will save user's data (profiletype and template) into Xipt tables * @param $userId * @param $saveSuccess * @return unknown_type */ function onAfterProfileUpdate($userId, $saveSuccess) { // data was not saved, do nothing if (false == $saveSuccess) { return true; } // the JomSocial already store values in field tables // now we need to apply that information to our tables // $cuser = CFactory::getUser($userId); // $profiletype = $cuser->getInfo(PROFILETYPE_CUSTOM_FIELD_CODE); // $template = $cuser->getInfo(TEMPLATE_CUSTOM_FIELD_CODE); $profiletype = XiptHelperUtils::getInfo($userId, PROFILETYPE_CUSTOM_FIELD_CODE); $template = XiptHelperUtils::getInfo($userId, TEMPLATE_CUSTOM_FIELD_CODE); // Changing Profile From Front End If The Template allow is None then Set Profiletype template. // If Template is Allowed on Profile Type Then Take User Define Template From Front End. $oldPtype = XiptLibProfiletypes::getUserData($userId, 'PROFILETYPE'); $OldallowToChangeTemplate = XiptHelperProfiletypes::getProfileTypeData($oldPtype, 'allowt'); $NewallowToChangeTemplate = XiptHelperProfiletypes::getProfileTypeData($profiletype, 'allowt'); //update profiletype only XiptLibProfiletypes::updateUserProfiletypeData($userId, $profiletype, $template, 'ALL'); //update template seperately $filter[] = 'template'; $allowToChangeTemplate = XiptFactory::getSettings('allow_templatechange', 0); if (($NewallowToChangeTemplate == 0 || $OldallowToChangeTemplate == 0) && $allowToChangeTemplate == 0) { $newData['template'] = XiptLibProfiletypes::getProfiletypeData($profiletype, 'template'); } else { $newData['template'] = $template; } XiptLibProfiletypes::updateUserProfiletypeFilteredData($userId, $filter, null, $newData); $this->showActivity($userId, $profiletype, $oldPtype); return true; }
/** * Returns any global configuration settings in JSPT * @param $paramName : the value of which variable you require * @param $defaultValue * @return unknown_type */ function getGlobalConfig($paramName = '', $defaultValue = 0) { if ($paramName === '') { return null; } return XiptFactory::getSettings($paramName, $defaultValue); }
function event_com_xipt_registration_blank() { $app = JFactory::getApplication(); $subs_integrate = XiptFactory::getSettings('subscription_integrate', 0); $integrate_with = XiptFactory::getSettings('integrate_with', 0); if (!$subs_integrate) { return false; } //when integrated with AEC, set PT in session as per plan. if ($integrate_with == 'aec') { if (!XiptLibAec::isAecExists()) { return false; } // find selected profiletype from AEC $aecData = XiptLibAec::getProfiletypeInfoFromAEC(); // as user want to integrate the AEC so a plan must be selected // send user to profiletype selection page if ($aecData['planSelected'] == false) { $app->redirect(XiptRoute::_('index.php?option=com_acctexp&task=subscribe', false), XiptText::_('PLEASE_SELECT_AEC_PLAN_IT_IS_RQUIRED')); } // set selected profiletype in session $this->_pluginHandler->mySess->set('SELECTED_PROFILETYPE_ID', $aecData['profiletype'], 'XIPT'); } //when integrated with Payplans, no need to set PT in session //payplans itself set PT in session if ($integrate_with == 'payplans') { if (!XiptLibPayplans::isPayplansExists()) { return false; } // find selected profiletype from Payplans $payplansData = XiptLibPayplans::getProfiletypeInfoFromPayplans(); // as user want to integrate the Payplans so a plan must be selected // send user to profiletype selection page if ($payplansData['planSelected'] == false) { $app->redirect(XiptRoute::_('index.php?option=com_payplans&view=plan', false), XiptText::_('PLEASE_SELECT_AEC_PLAN_IT_IS_RQUIRED')); } } $app->redirect(XiptHelperJomsocial::getReturnURL()); return true; }
<?php /** * @Copyright Ready Bytes Software Labs Pvt. Ltd. (C) 2010- author-Team Joomlaxi * @license GNU/GPL http://www.gnu.org/copyleft/gpl.html **/ ?> <link rel="stylesheet" type="text/css" href="<?php echo JURI::root() . '/components/com_xipt/assets/style.css'; ?> " /> <div class="registerProfileType" style="height:300px;overflow:scroll;"> <?php echo XiptText::_('PROFILE_TYPE_DESCRIPTION_FOR_SELECTBOX') . "<br />"; if (XiptFactory::getSettings('jspt_fb_show_radio', 0)) { include JPATH_ROOT . DS . 'components' . DS . 'com_xipt' . DS . 'views' . DS . 'registration' . DS . 'tmpl' . DS . 'facebook_radio.php'; } else { include JPATH_ROOT . DS . 'components' . DS . 'com_xipt' . DS . 'views' . DS . 'registration' . DS . 'tmpl' . DS . 'facebook_select.php'; } ?> </div>
function integrateRegistrationWithPType() { $aecExists = XiptLibAec::isAecExists(); $payplansExists = XiptLibPayplans::isPayplansExists(); $subs_integrate = XiptFactory::getSettings('subscription_integrate', 0); $integrate_with = XiptFactory::getSettings('integrate_with', 0); $show_ptype_during_reg = XiptFactory::getSettings('show_ptype_during_reg', 0); $selectedProfiletypeID = $this->isPTypeExistInSession(); if ($show_ptype_during_reg) { $link = "index.php?option=com_xipt&view=registration"; // pType not selected : send to select profiletype if (!$selectedProfiletypeID) { $this->app->redirect(XiptRoute::_("index.php?option=com_xipt&view=registration", false)); return; } // pType already selected if ($aecExists && $subs_integrate && $integrate_with == 'aec') { $url = XiptRoute::_('index.php?option=com_acctexp&task=subscribe', false); $msg = XiptLibAec::getAecMessage(); if ($msg != false) { $link = '<a id="xipt_back_link" href=' . $url . '>' . XiptText::_("CLICK_HERE") . '</a>'; $this->app->enqueueMessage($msg . ' ' . $link); } return; } else { $url = XiptRoute::_('index.php?option=com_xipt&view=registration&ptypeid=' . $selectedProfiletypeID . '&reset=true', false); $selectedpTypeName = XiptLibProfiletypes::getProfiletypeName($selectedProfiletypeID); $msg = sprintf(XiptText::_('CURRENT_PTYPE_AND_CHANGE_PTYPE_OPTION'), $selectedpTypeName); $link = '<a id="xipt_back_link" href=' . $url . '>' . XiptText::_("CLICK_HERE") . '</a>'; $this->app->enqueueMessage($msg . ' ' . $link); return; } } else { if ($subs_integrate) { if ($payplansExists && $integrate_with == 'payplans') { $url = XiptRoute::_('index.php?option=com_payplans&view=plan', false); $msg = XiptLibPayplans::getPayplansMessage(); if ($msg != false) { $link = '<a id="xipt_back_link" href=' . $url . '>' . XiptText::_("CLICK_HERE") . '</a>'; $this->app->enqueueMessage($msg . ' ' . $link); } return; } } } // if pType is not set, collect default pType // set it in session if (!$selectedProfiletypeID) { $pType = $this->getRegistrationPType(); $this->setDataInSession('SELECTED_PROFILETYPE_ID', $pType); return; } return; }
function getUserData($userid, $what = 'PROFILETYPE') { $results = array(); switch ($what) { case 'PROFILETYPE': if ($userid == 0) { return XiptFactory::getSettings('guestProfiletypeID', XiptFactory::getSettings('defaultProfiletypeID', 0)); } $getMe = PROFILETYPE_FIELD_IN_USER_TABLE; $defaultValue = XiptLibProfiletypes::getDefaultProfiletype(); break; case 'TEMPLATE': $getMe = TEMPLATE_FIELD_IN_USER_TABLE; $allTemplates = XiptHelperJomsocial::getTemplatesList(); $pID = XiptLibProfiletypes::getUserData($userid, 'PROFILETYPE'); $defaultValue = XiptLibProfiletypes::getProfileTypeData($pID, 'template'); //else get system template if (in_array($defaultValue, $allTemplates) === false) { $defaultValue = XiptLibProfiletypes::getDefaultTemplate(); } break; default: XiptError::raiseError('XIPT-SYSTEM-ERROR', 'XIPT System Error'); } $results = XiptFactory::getInstance('users', 'model')->loadRecords(0); // not a valid result OR value not set if (!$results || isset($results[$userid]) == false) { return $defaultValue; } $what = strtolower($what); return $results[$userid]->{$what}; }