Пример #1
0
    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;">&nbsp;</span>';
        return $html;
    }
Пример #2
0
 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();
 }
Пример #3
0
 function _buildProfiletypes($value)
 {
     $allTypes = XiptLibProfiletypes::getProfiletypeArray();
     if (!$allTypes) {
         return false;
     }
     return JHTML::_('select.genericlist', $allTypes, 'profiletypes', 'class="inputbox"', 'id', 'name', $value);
 }
Пример #4
0
 function display($tpl = null)
 {
     $profiletype = $this->getModel();
     $pagination = $profiletype->getPagination();
     $fields = $profiletype->loadRecords($pagination->limit, $pagination->limitstart);
     $profiletypes = array();
     $allTypes = XiptLibProfiletypes::getProfiletypeArray();
     $this->setToolbar();
     $this->assignRef('fields', $fields);
     $this->assignRef('pagination', $pagination);
     return parent::display($tpl);
 }
Пример #5
0
 function isApplicable()
 {
     $xipt_ProfileTypes = XiptLibProfiletypes::getProfiletypeArray(array('published' => 1));
     jimport('joomla.application.component.model');
     JModel::addIncludePath(JPATH_BASE . DS . 'components' . DS . 'com_community' . DS . 'models');
     $multiprofileModel = JModel::getInstance('MultiProfile', 'CommunityModel');
     $js_Profiletypes = $multiprofileModel->getMultiProfiles();
     $config = CFactory::getConfig();
     if (empty($xipt_ProfileTypes) && $js_Profiletypes && $config->get('profile_multiprofile')) {
         return true;
     }
     return false;
 }
Пример #6
0
 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);
 }
Пример #7
0
 function getResetLinkArray()
 {
     $resetArray = array();
     $allPTypes = XiptLibProfiletypes::getProfiletypeArray();
     if (!empty($allPTypes)) {
         foreach ($allPTypes as $ptype) {
             if ($ptype->params) {
                 $resetArray[$ptype->id] = true;
             } else {
                 $resetArray[$ptype->id] = false;
             }
         }
     }
     return $resetArray;
 }
Пример #8
0
 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);
 }
Пример #9
0
 function getProfiletypeFieldHTML($name, $value, $control_name = 'params', $reqnone = false, $reqall = false, $multiselect = false)
 {
     $required = '1';
     $html = '';
     $class = $required == 1 ? ' required' : '';
     $options = XiptLibProfiletypes::getProfiletypeArray();
     if ($multiselect) {
         $html .= '<select id="' . $control_name . '[' . $name . '][]" name="' . $control_name . '[' . $name . '][]" value="" style="margin: 0 5px 5px 0;"  size="3" multiple/>';
     } else {
         $html .= '<select id="' . $control_name . '[' . $name . ']" name="' . $control_name . '[' . $name . ']" title="' . "Select Account Type" . '::' . "Please Select your account type" . '">';
     }
     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;
         if (!is_array($value)) {
             $value = array($value);
         }
         $selected = in_array($id, $value) ? ' selected="true"' : '';
         if ($multiselect) {
             $html .= '<option name="' . $name . '_' . $id . '" "' . $selected . '" value="' . $id . '">';
             $html .= $option . '</option>';
         } else {
             $html .= '<option value="' . $id . '"' . $selected . '>' . $option . '</option>';
         }
     }
     $html .= '</select>';
     $html .= '<span id="errprofiletypemsg" style="display: none;">&nbsp;</span>';
     return $html;
 }
Пример #10
0
 function onAfterDispatch()
 {
     $app = JFactory::getApplication();
     if ($app->isAdmin()) {
         if ($this->_pluginHandler->checkSetupRequired()) {
             $app->enqueueMessage(XiptText::_('JSPT_SETUP_SCREEN_IS_NOT_CLEAN_PLEASE_CLEAN_IT_STEP_BY_STEP'), 'error');
         }
         return true;
     }
     // get option, view and task
     $option = JRequest::getVar('option');
     $view = JRequest::getVar('view');
     $task = JRequest::getVar('task');
     // Hide Privacy menus
     if ($option == 'com_community') {
         self::_hidePrivacyMenus();
     }
     if ($option != 'com_community' || $view != 'search' || $task != 'advancesearch') {
         return true;
     }
     $allTypes = XiptLibProfiletypes::getProfiletypeArray(array('published' => 1, 'visible' => 1));
     if (!$allTypes) {
         return false;
     }
     // when we are getting Html of select list(for Profile-Types)
     //then  don't addd "\n" at end of line
     if (!XIPT_JOOMLA_15) {
         JHtml::$formatOptions = array_merge(JHtml::$formatOptions, array('format.eol' => ""));
     }
     $profileType = JHTML::_('select.genericlist', $allTypes, 'profiletypes', 'class="inputbox"', 'id', 'name');
     ob_start();
     $this->_addXiptSearchScript($profileType);
     $content = ob_get_contents();
     ob_clean();
     $doc = JFactory::getDocument();
     if (XIPT_JOOMLA_15) {
         JHTML::script('jquery1.4.2.js', 'components/com_xipt/assets/js/', true);
     } else {
         JHTML::script('components/com_xipt/assets/js/jquery1.4.2.js');
     }
     $doc->addCustomTag('<script type="text/javascript">jQuery.noConflict();</script>');
     $doc->addScriptDeclaration($content);
     return true;
 }
Пример #11
0
 /**
  * If profiletype exist and published return true
  * else return false,
  * IMP : If empty profiletype returns false
  *
  * @param $profileTypeID
  * @return boolean
  */
 function validateProfiletype($profileTypeID, $filter = array('published' => 1))
 {
     if (empty($profileTypeID)) {
         return false;
     }
     $allProfileTypes = XiptLibProfiletypes::getProfiletypeArray($filter);
     if (empty($allProfileTypes)) {
         return false;
     }
     $profiletypeIDs = array_keys($allProfileTypes);
     if (in_array($profileTypeID, $profiletypeIDs)) {
         return true;
     }
     return false;
 }
Пример #12
0
 function getProfileTypeIds($filter = '')
 {
     return XiptLibProfiletypes::getProfiletypeArray($filter);
 }