本文整理汇总了PHP中OW_ActionController::assign方法的典型用法代码示例。如果您正苦于以下问题:PHP OW_ActionController::assign方法的具体用法?PHP OW_ActionController::assign怎么用?PHP OW_ActionController::assign使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OW_ActionController
的用法示例。
在下文中一共展示了OW_ActionController::assign方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* @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);
}
示例2: __construct
public function __construct(OW_ActionController $controller)
{
parent::__construct('settings-form');
$lang = OW::getLanguage();
$newLogin = new CheckboxField('newLogin');
$newLogin->setLabel($lang->text('femaleregonlymen', 'login_as_user'));
$this->addElement($newLogin);
$questionNameList = array('username', 'email', 'password', 'sex');
$questionDtoList = BOL_QuestionService::getInstance()->findQuestionByNameList($questionNameList);
$orderedQuestionList = array();
$questionService = BOL_QuestionService::getInstance();
$questionValueList = $questionService->findQuestionsValuesByQuestionNameList($questionNameList);
foreach ($questionNameList as $questionName) {
if (!empty($questionDtoList[$questionName])) {
$orderedQuestionList[] = get_object_vars($questionDtoList[$questionName]);
}
}
$this->addQuestions($orderedQuestionList, $questionValueList);
$controller->assign('questions', $orderedQuestionList);
$submit = new Submit('reg_fake');
$submit->setValue($lang->text('femaleregonlymen', 'reg_fake'));
$this->addElement($submit);
}
示例3: __construct
/**
* @param OW_ActionController $controller
*/
public function __construct($controller)
{
parent::__construct('MainSearchForm');
$this->controller = $controller;
$questionService = BOL_QuestionService::getInstance();
$this->setId('MainSearchForm');
$submit = new Submit(self::SUBMIT_NAME);
$submit->setValue(OW::getLanguage()->text('base', 'user_search_submit_button_label'));
$this->addElement($submit);
$questionData = OW::getSession()->get(self::FORM_SESSEION_VAR);
if ($questionData === null) {
$questionData = array();
if (OW::getUser()->isAuthenticated()) {
$data = BOL_QuestionService::getInstance()->getQuestionData(array(OW::getUser()->getId()), array('match_sex'));
$questionData['match_sex'] = $data[OW::getUser()->getId()]['match_sex'];
$questionData['googlemap_location']['distance'] = 50;
OW::getSession()->set(self::FORM_SESSEION_VAR, $questionData);
}
}
if (!empty($questionData['match_sex'])) {
if (is_array($questionData['match_sex'])) {
$questionData['match_sex'] = array_shift($questionData['match_sex']);
} else {
for ($i = 0; $i < 31; $i++) {
if (pow(2, $i) & $questionData['match_sex']) {
$questionData['match_sex'] = pow(2, $i);
break;
}
}
}
}
$accounts = $this->getAccountTypes();
$accountList = array();
foreach ($accounts as $key => $account) {
$accountList[$key] = $account;
}
$keys = array_keys($accountList);
$this->accountType = $keys[0];
$this->matchSexValue = USEARCH_BOL_Service::getInstance()->getGenderByAccounType($this->accountType);
if (isset($questionData['match_sex'])) {
$accountType = USEARCH_BOL_Service::getInstance()->getAccounTypeByGender($questionData['match_sex']);
if (!empty($accountType)) {
$this->accountType = $accountType;
$this->matchSexValue = $questionData['match_sex'];
}
}
$questions = $questionService->findSearchQuestionsForAccountType($this->accountType);
$mainSearchQuestion = array();
$questionNameList = array('sex' => 'sex', 'match_sex' => 'match_sex');
foreach ($questions as $key => $question) {
$sectionName = $question['sectionName'];
$questionNameList[] = $question['name'];
$isRequired = in_array($question['name'], array('googlemap_location', 'match_sex')) ? 1 : 0;
$questions[$key]['required'] = $isRequired;
if ($question['name'] == 'sex' || $question['name'] == 'match_sex') {
unset($questions[$key]);
} else {
$mainSearchQuestion[$sectionName][] = $question;
}
}
$questionValueList = $questionService->findQuestionsValuesByQuestionNameList($questionNameList);
$controller->assign('displayGender', false);
if (count($accounts) > 1) {
$this->displayAccountType = true;
if (!OW::getUser()->isAuthenticated()) {
$controller->assign('displayGender', true);
$sex = new Selectbox('sex');
$sex->setLabel(BOL_QuestionService::getInstance()->getQuestionLang('sex'));
$sex->setRequired();
$sex->setHasInvitation(false);
//$accountType->setHasInvitation(false);
$this->setFieldOptions($sex, 'sex', $questionValueList['sex']);
if (!empty($questionData['sex'])) {
$sex->setValue($questionData['sex']);
}
$this->addElement($sex);
} else {
$sexData = BOL_QuestionService::getInstance()->getQuestionData(array(OW::getUser()->getId()), array('sex'));
if (!empty($sexData[OW::getUser()->getId()]['sex'])) {
$sex = new HiddenField('sex');
$sex->setValue($sexData[OW::getUser()->getId()]['sex']);
$this->addElement($sex);
}
}
$matchSex = new Selectbox('match_sex');
$matchSex->setLabel(BOL_QuestionService::getInstance()->getQuestionLang('match_sex'));
$matchSex->setRequired();
$matchSex->setHasInvitation(false);
//$accountType->setHasInvitation(false);
$this->setFieldOptions($matchSex, 'match_sex', $questionValueList['sex']);
if (!empty($questionData['match_sex'])) {
$matchSex->setValue($questionData['match_sex']);
}
$this->addElement($matchSex);
}
$this->addQuestions($questions, $questionValueList, $questionData);
$locationField = $this->getElement('googlemap_location');
//.........这里部分代码省略.........