protected function setFieldOptions($formField, $questionName, array $questionValues)
 {
     parent::setFieldOptions($formField, $questionName, $questionValues);
     if ($questionName == 'match_sex') {
         $options = array_reverse($formField->getOptions(), true);
         $formField->setOptions($options);
     }
     $formField->setLabel(OW::getLanguage()->text('base', 'questions_question_' . $questionName . '_label'));
 }
示例#2
0
 public function __construct()
 {
     parent::__construct('MATCHMAKING_PreferencesForm');
     $this->questionService = BOL_QuestionService::getInstance();
     $language = OW::getLanguage();
     $save = new Submit('save');
     $save->setValue($language->text('matchmaking', 'btn_label_save'));
     $this->addElement($save);
 }
 /**
  * @param OW_ActionController $controller
  */
 public function __construct($controller)
 {
     parent::__construct('DisplayNameSearchForm');
     $this->controller = $controller;
     $questionService = BOL_QuestionService::getInstance();
     $this->setId('DisplayNameSearchForm');
     $submit = new Submit(self::SUBMIT_NAME);
     $submit->setValue(OW::getLanguage()->text('base', 'user_search_submit_button_label'));
     $this->addElement($submit);
     $questionName = OW::getConfig()->getValue('base', 'display_name_question');
     $question = $questionService->findQuestionByName($questionName);
     $questionPropertyList = array();
     foreach ($question as $property => $value) {
         $questionPropertyList[$property] = $value;
     }
     $this->addQuestions(array($questionName => $questionPropertyList), array(), array());
     $controller->assign('displayNameQuestion', $questionPropertyList);
 }
 protected function setFieldOptions($formField, $questionName, array $questionValues)
 {
     parent::setFieldOptions($formField, $questionName, $questionValues);
     $config = OW::getConfig();
     $opositeMatchSexSearch = $config->getValue('selectgender', 'opositeMatchSexSearch');
     $sameMatchSexSearch = $config->getValue('selectgender', 'sameMatchSexSearch');
     $isUserRegister = OW::getUser()->isAuthenticated();
     $jsParams = array('isUserRegister' => $isUserRegister, 'opositeMatchSexSearch' => $opositeMatchSexSearch, 'sameMatchSexSearch' => $sameMatchSexSearch);
     $script = ' var admin = new SELECTGENDER_Search(); admin.init(' . json_encode($jsParams) . '); ';
     OW::getDocument()->addOnloadScript($script);
     OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('selectgender')->getStaticJsUrl() . 'search.js');
     if ($questionName == 'match_sex') {
         $options = array_reverse($formField->getOptions(), true);
         $formField->setOptions($options);
     }
     $formField->setLabel(OW::getLanguage()->text('base', 'questions_question_' . $questionName . '_label'));
 }
 public function __construct($name, $userId = null)
 {
     parent::__construct($name);
     if ($userId != null) {
         $this->userId = $userId;
     }
 }
示例#6
0
文件: join.php 项目: ZyXelP/oxwall
 protected function setFieldOptions($formField, $questionName, array $questionValues)
 {
     $realQuestionList = OW::getSession()->get(self::SESSION_REAL_QUESTION_LIST);
     $name = $questionName;
     if (!empty($realQuestionList[$questionName])) {
         $name = $realQuestionList[$questionName];
     }
     parent::setFieldOptions($formField, $name, $questionValues);
 }
示例#7
0
文件: join.php 项目: vazahat/dudex
 protected function setFieldOptions($formField, $questionName, array $questionValues)
 {
     $valuesArray = array();
     $realQuestionList = OW::getSession()->get(self::SESSION_REAL_QUESTION_LIST);
     $name = $questionName;
     if (!empty($realQuestionList[$questionName])) {
         $name = $realQuestionList[$questionName];
     }
     parent::setFieldOptions($formField, $name, $questionValues);
     /* foreach ( $questionValues as $values )
             {
                 if ( is_array($values) )
                 {
                     foreach ( $values as $value )
                     {
                         $valuesArray[($value->value)] = OW::getLanguage()->text('base', 'questions_question_' . $value->questionName . '_value_' . ($value->value));
                     }
                 }
             }
     
             $formField->setOptions($valuesArray); */
 }
    protected function setFieldOptions($formField, $questionName, array $questionValues)
    {
        parent::setFieldOptions($formField, $questionName, $questionValues);
        if ($questionName == 'match_sex') {
            $options = array_reverse($formField->getOptions(), true);
            $formField->setOptions($options);
        }
        if (OW::getUser()->isAuthenticated()) {
            $js = '
    var input = $("select[name=match_sex]", form);
    input.hide();
    $("[for=" + input.attr("id") + "]").hide();
    var form = $("form[name=MainSearchForm]");
    $gender = $("input[name=sex]", form).val();
    if($gender == 1)
    {
        $("[name = match_sex] [value=\'1\']", form). remove();
    }
    else
    {
        $("[name = match_sex] [value=\'2\']", form). remove();
    }

    ;';
        } else {
            $js = '
    var form = $("form[name=MainSearchForm]");
    var input = $("select[name=match_sex]", form);
    input.hide();

    var gender = $("select[name=sex]",form);
    gender.closest("tr").hide();
    $("[for=" + gender.attr("id") + "]").hide();

    $("[for=" + input.attr("id") + "]").hide();
     $("select[name=sex]", form).change(
    function() {
        $("[for=" + input.attr("id") + "]").hide();
        $matchSex = $("select[name=sex]").val();
        $("select[name=match_sex] option").remove();
        $("select[name=sex] option").each(
        function(k,item)
        {
            if( $(item).val() != $matchSex )
            {
                $("select[name=match_sex]").append($(item).clone());
            }
        }
    );
} );';
        }
        OW::getDocument()->addOnloadScript($js);
        $formField->setLabel(OW::getLanguage()->text('base', 'questions_question_' . $questionName . '_label'));
    }