public function PutOptionsDialog()
 {
     $O = new UserOptions();
     $userInfo = $this->_user->GetUserInfo($this->_user->username);
     $userId = $userInfo['id'];
     $options = $O->GetOptions($userId);
     unset($O);
     $optionsStr = '';
     foreach ($options as $key => $val) {
         $input = sprintf('<input  class="options-value-input" name="%s" value="%s">', $key, $val);
         $optionsStr .= sprintf('<div class="options-row">' . '<div class="options-name">%s</div>' . '<div class="options-value">%s</div>' . '<div class="options-clear"></div>' . '</div>', isset($this->lang->{$key}) ? $this->lang->{$key} : $key, $input);
     }
     $version = '1.01';
     if (defined('VERSION')) {
         $version = VERSION;
     }
     printf("<div id='optionsDialog' class='options-dialog' title='%s'>\r\n                <form id='optionsForm'>\r\n                    %s\r\n                </form>\r\n                <p class='options-dialog__version'>Version: %s</p>\r\n                </div>", $this->lang->options, $optionsStr, $version);
 }
Example #2
0
 public function getUserOptionValue($userId, $attributeId)
 {
     if (UserOptions::model()->findByAttributes(array("UserId" => $userId, "AttributeId" => $attributeId))) {
         $data = UserOptions::model()->findByAttributes(array("UserId" => $userId, "AttributeId" => $attributeId));
         return $data->AttributeValueId;
     } else {
         return '';
     }
 }
 public function getNVPRequest()
 {
     $request = $this->collection->getAllValues();
     /* payment */
     foreach ($this->payments as $index => $payment) {
         foreach ($payment->getNVPArray() as $key => $value) {
             if (is_array($value)) {
                 // payment item is array and has to start with L_
                 foreach ($value as $itemIndex => $item) {
                     foreach ($item as $k => $v) {
                         $request['L_PAYMENTREQUEST_' . $index . '_' . $k . $itemIndex] = $v;
                     }
                 }
             } else {
                 $request['PAYMENTREQUEST_' . $index . '_' . $key] = $value;
             }
         }
     }
     /* user selected options */
     if ($this->userOptions != null) {
         $request = array_merge($request, $this->userOptions->getNVPArray());
     }
     return $request;
 }
 /**
  * This is the default 'index' action that is invoked
  * when an action is not explicitly requested by users.
  */
 public function actionIndex()
 {
     if (Yii::app()->user->isGuest) {
         $this->layout = 'login';
         $model = new LoginForm();
         // if it is ajax validation request
         if (isset($_POST['ajax']) && $_POST['ajax'] === 'login-form') {
             echo CActiveForm::validate($model);
             Yii::app()->end();
         }
         // collect user input data
         if (isset($_POST['LoginForm'])) {
             $date = date('Y-m-d H:i:s');
             $model->attributes = $_POST['LoginForm'];
             // validate user input and redirect to the previous page if valid
             if ($model->validate() && $model->login()) {
                 $loginUserID = Yii::app()->user->getId();
                 Users::model()->updateByPk($loginUserID, array('LoginStatus' => 1, 'LastLoginDate' => $date));
                 /* $this->redirect(array('site/index')); */
                 $this->redirect(Yii::app()->user->returnUrl);
             }
         }
         // display the login form
         $this->render('login', array('model' => $model));
     } else {
         $pageCount = 20;
         $loginUserId = Yii::app()->user->getId();
         $favourites = Favourites::model()->findByAttributes(array('UserId' => $loginUserId));
         if (!empty($favourites)) {
             $favourites = explode(',', $favourites->FavouriteIds);
         }
         $criteria = new CDbCriteria();
         $condition = "Status=1 AND SearchStatus=1 AND Objid <> {$loginUserId}";
         if (isset($_GET['searchAttList'])) {
             $criteria->condition = "UserId !='" . $loginUserId . "'";
             $options_list = UserOptions::model()->findAll($criteria);
             $key = array();
             $i = 0;
             $hasAttrUser = array();
             if ($_GET['searchAttList'] !== '') {
                 $values = explode(',', $_GET['searchAttList']);
                 foreach ($options_list as $option) {
                     $AttrOption = CJSON::decode($option->AttributeValueId);
                     foreach ($AttrOption['basic'] as $attr) {
                         if (is_array($attr)) {
                             foreach ($values as $value) {
                                 array_push($key, in_array($value, $attr));
                             }
                         }
                     }
                     foreach ($values as $value) {
                         array_push($key, in_array($value, $AttrOption['basic']));
                     }
                     $key = array_filter($key);
                     if (count($key) == count($values)) {
                         $hasAttrUser[$i++] = $option->UserId;
                     }
                 }
                 $condition .= !empty($hasAttrUser) ? " AND Objid IN(" . implode(',', $hasAttrUser) . ")" : ' AND Objid = 0';
             }
         }
         if (isset($_GET['MinAge']) && isset($_GET['MaxAge'])) {
             $minAge = $_GET['MinAge'];
             $maxAge = $_GET['MaxAge'];
             $minAge1 = $_GET['MinAge'] - 1;
             $maxAge1 = $_GET['MaxAge'] + 1;
             $toDate = date('Y-m-d', strtotime('-' . $minAge1 . ' years'));
             $fromDate = date('Y-m-d', strtotime('-' . $maxAge1 . ' years'));
             $condition .= " AND DateOfBirth BETWEEN '" . $fromDate . "' AND '" . $toDate . "'";
         }
         if (isset($_GET['Gender'])) {
             $condition .= $_GET['Gender'] !== '' ? " AND Gender=" . $_GET['Gender'] : " AND Gender=0 OR Gender=1";
         }
         $criteria->addCondition($condition);
         if (isset($_GET['type'])) {
             $criteria->compare("LoginStatus", 1, true);
         }
         $model = Profile::model()->findAll($criteria);
         $count = Profile::model()->count($criteria);
         $pages = new CPagination($count);
         $pages->pageSize = $pageCount;
         $pages->applyLimit($criteria);
         $this->render('list', array('models' => $model, 'pages' => $pages, 'pageCount' => $pageCount, 'favourites' => $favourites));
     }
 }
/**
 * Script to change users preferences on the fly.
 *
 * Made on an original idea by Fooey (freenode)
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 * http://www.gnu.org/copyleft/gpl.html
 *
 * @file
 * @ingroup Maintenance
 * @author Antoine Musso <hashar at free dot fr>
 */
// This is a command line script, load tools and parse args
require_once 'userOptions.inc';
// Load up our tool system, exit with usage() if options are not fine
$uo = new UserOptions($options, $args);
$uo->run();
print "Done.\n";
 /**
  * Deletes a particular model.
  * If deletion is successful, the browser will be redirected to the 'admin' page.
  * @param integer $id the ID of the model to be deleted
  */
 public function actionDelete($id)
 {
     UserOptions::model()->deleteAllByAttributes(array('AttributeId' => $id));
     UserText::model()->deleteAllByAttributes(array('AttributeId' => $id));
     AttributeValues::model()->deleteAllByAttributes(array('AttributeId' => $id));
     $this->loadModel($id)->delete();
     // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
     if (!isset($_GET['ajax'])) {
         $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin'));
     }
 }
 /**
  * This is the default 'index' action that is invoked
  * when an action is not explicitly requested by users.
  */
 public function actionIndex()
 {
     if (Yii::app()->user->isGuest) {
         $this->layout = 'login';
         $model = new LoginForm();
         // if it is ajax validation request
         if (isset($_POST['ajax']) && $_POST['ajax'] === 'login-form') {
             echo CActiveForm::validate($model);
             Yii::app()->end();
         }
         // collect user input data
         if (isset($_POST['LoginForm'])) {
             // echo "tetste"; exit();
             $date = date('Y-m-d H:i:s');
             // print_r($_POST['LoginForm']);exit();
             $model->attributes = $_POST['LoginForm'];
             // validate user input and redirect to the previous page if valid
             if ($model->validate() && $model->login()) {
                 $loginUserID = Yii::app()->user->getId();
                 Users::model()->updateByPk($loginUserID, array('LoginStatus' => 1, 'LastLoginDate' => $date));
                 /* $this->redirect(array('site/index')); */
                 $this->redirect(Yii::app()->user->returnUrl);
             }
         }
         // display the login form
         $this->render('login', array('model' => $model));
     } else {
         $loginUserId = Yii::app()->user->getId();
         $message = new Messages();
         $userList = array();
         $idLilst = array();
         $location = '';
         $genVal = '';
         $minAge = 18;
         $maxAge = 30;
         $pageCount = 20;
         $criteria = new CDbCriteria();
         $condition = "Status=1 AND SearchStatus=1 AND Objid <> {$loginUserId}";
         if (isset($_POST['Messages'])) {
             $message->attributes = $_POST['Messages'];
             $message->SenderId = $loginUserId;
             $message->Date = date('Y-m-d H:i:s');
             if ($message->save()) {
                 $this->redirect(array('site/index'));
             }
         }
         if (isset($_GET['Find'])) {
             $minAge = $_GET['MinAge'];
             $maxAge = $_GET['MaxAge'];
             $minAge1 = $_GET['MinAge'] - 1;
             $maxAge1 = $_GET['MaxAge'] + 1;
             $toDate = date('Y-m-d', strtotime('-' . $minAge1 . ' years'));
             $fromDate = date('Y-m-d', strtotime('-' . $maxAge1 . ' years'));
             $condition .= " AND DateOfBirth BETWEEN '" . $fromDate . "' AND '" . $toDate . "'";
             if (isset($_GET['searchAttList'])) {
                 $idLilst = $_GET['searchAttList'];
                 $attributes = implode(',', $idLilst);
                 $criteria2 = new CDbCriteria();
                 $criteria2->condition = "AttributeValueId IN(" . $attributes . ") GROUP BY AttributeId";
                 $total = UserOptions::model()->findAll($criteria2);
                 $count = count($total);
                 $count = $count - 1;
                 $criteria1 = new CDbCriteria(array('having' => 'COUNT(ObjId) > ' . $count));
                 $criteria1->condition = "AttributeValueId IN(" . $attributes . ")";
                 $criteria1->group = "UserId";
                 $userData = UserOptions::model()->findAll($criteria1);
                 if ($userData) {
                     foreach ($userData as $data) {
                         $userList[] = $data->UserId;
                     }
                     $condition .= " AND Objid IN (" . implode(',', $userList) . ")";
                 } else {
                     $condition .= " AND Objid IN (0)";
                 }
             }
             if (isset($_GET['Gender']) && $_GET['Gender']) {
                 $genVal = $_GET['Gender'];
                 if ($_GET['Gender'] == 1) {
                     $condition .= " AND Gender=0";
                 } else {
                     if ($_GET['Gender'] == 2) {
                         $condition .= " AND Gender=1";
                     }
                 }
             }
             if (isset($_GET['Location']) && $_GET['Location']) {
                 $location = $_GET['Location'];
                 $condition .= " AND CityOrPostal LIKE '%" . $location . "%'";
             }
             if (isset($_GET['postsPerPage']) && $_GET['postsPerPage']) {
                 $pageCount = $_GET['postsPerPage'];
             }
         }
         if (isset($_GET['type']) && $_GET['type'] == 'online') {
             $expDate = date('Y-m-d H:i:s', strtotime('-2 minutes'));
             $condition .= " AND LoginStatus=1 AND LastActivity >'" . $expDate . "'";
         }
         if (isset($_GET['type']) && $_GET['type'] == 'new') {
             $now = date('Y-m-d H:i:s', strtotime('last month'));
             $condition .= ' AND CreatedDate > "' . $now . '"';
         }
         $criteria->condition = $condition;
         $count = Profile::model()->count($criteria);
         $pages = new CPagination($count);
         $pages->pageSize = $pageCount;
         $pages->applyLimit($criteria);
         $model = Profile::model()->findAll($criteria);
         $this->render('list', array('models' => $model, 'location' => $location, 'idLilst' => $idLilst, 'gender' => $genVal, 'minAge' => $minAge, 'maxAge' => $maxAge, 'pages' => $pages, 'pageCount' => $pageCount, 'message' => $message));
     }
 }
 /**
  * Deletes a particular model.
  * If deletion is successful, the browser will be redirected to the 'admin' page.
  * @param integer $id the ID of the model to be deleted
  */
 public function actionDelete($id)
 {
     $folder = Yii::getPathOfAlias('webroot') . '/../images/users/';
     UserText::model()->deleteAllByAttributes(array("UserId" => $id));
     UserOptions::model()->deleteAllByAttributes(array("UserId" => $id));
     MembershipUsers::model()->deleteAllByAttributes(array("UserId" => $id));
     Messages::model()->deleteAllByAttributes(array("SenderId" => $id));
     Messages::model()->deleteAllByAttributes(array("ReceiverId" => $id));
     if (UserImages::model()->findAllByAttributes(array("UserId" => $id))) {
         $imgList = UserImages::model()->findAllByAttributes(array("UserId" => $id));
         foreach ($imgList as $list) {
             unlink($folder . $list->ImagePath);
         }
     }
     UserImages::model()->deleteAllByAttributes(array("UserId" => $id));
     $this->loadModel($id)->delete();
     // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
     if (!isset($_GET['ajax'])) {
         $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin'));
     }
 }
 public function actionIndex()
 {
     $id = Yii::app()->user->getId();
     $model = $this->loadModel($id);
     if (UserOptions::model()->findByAttributes(array('UserId' => $id))) {
         $options_list = UserOptions::model()->findByAttributes(array('UserId' => $id));
     } else {
         $options_list = new UserOptions();
     }
     $profileImage = UserImages::model()->findByAttributes(array("UserId" => $id, "MainImage" => 1));
     $UserOption = UserOptions::model()->findByAttributes(array('UserId' => $id));
     $birthday = explode('-', $model->DateOfBirth);
     $model->year = $birthday[0];
     $model->month = $birthday[1];
     $model->day = $birthday[2];
     if (isset($_POST['Profile'])) {
         $model->attributes = $_POST['Profile'];
         $model->year = $_POST['Profile']['year'];
         $model->month = $_POST['Profile']['month'];
         $model->day = $_POST['Profile']['day'];
         $dob = (string) $model->year . "-" . $model->month . "-" . $model->day;
         $timestamp = strtotime($dob);
         $model->DateOfBirth = date('Y-m-d', $timestamp);
         $model->save(false);
     }
     if (isset($_POST['UserOptions'])) {
         $data = array();
         $data['basic'] = $_POST['UserOptions']['AttributeValueId'];
         $jsonData = CJSON::encode($data);
         $options_list = UserOptions::model()->findByAttributes(array('UserId' => $id));
         if ($options_list) {
             $options_list->UserId = $id;
             $options_list->AttributeValueId = $jsonData;
         } else {
             $options_list = new UserOptions();
             $options_list->UserId = $id;
             $options_list->AttributeValueId = $jsonData;
         }
         $options_list->save(false);
     }
     $this->render('index', array('model' => $model, 'options_list' => $options_list, 'profileImage' => $profileImage));
 }
 public function UpdateUserOptions($form)
 {
     $userInfo = $this->GetUserInfo();
     $userId = $userInfo['id'];
     $O = new UserOptions();
     $O->UpdateOptions($form, $userId);
     unset($O);
     return $form;
 }
 public function actionIndex()
 {
     if (Yii::app()->user->isGuest) {
         $this->redirect(Yii::app()->getBaseUrl(true));
     }
     $userList = array();
     $idLilst = array();
     $genVal = '';
     $minAge = 18;
     $maxAge = 30;
     $pageCount = 10;
     $criteria = new CDbCriteria();
     $condition = "Status=1 AND SearchStatus=1";
     if (isset($_GET['Browse'])) {
         $minAge = $_GET['MinAge'] - 1;
         $maxAge = $_GET['MaxAge'] + 1;
         $toDate = date('Y-m-d', strtotime('-' . $minAge . ' years'));
         $fromDate = date('Y-m-d', strtotime('-' . $maxAge . ' years'));
         $condition .= " AND DateOfBirth BETWEEN '" . $fromDate . "' AND '" . $toDate . "'";
         if (isset($_GET['searchAttList'])) {
             $idLilst = $_GET['searchAttList'];
             $attributes = implode(',', $idLilst);
             $criteria2 = new CDbCriteria();
             $criteria2->condition = "AttributeValueId IN(" . $attributes . ") GROUP BY AttributeId";
             $total = UserOptions::model()->findAll($criteria2);
             $count = count($total);
             $count = $count - 1;
             $criteria1 = new CDbCriteria(array('having' => 'COUNT(ObjId) > ' . $count));
             $criteria1->condition = "AttributeValueId IN(" . $attributes . ")";
             $criteria1->group = "UserId";
             $userData = UserOptions::model()->findAll($criteria1);
             if ($userData) {
                 foreach ($userData as $data) {
                     $userList[] = $data->UserId;
                 }
                 $condition .= " AND Objid IN (" . implode(',', $userList) . ")";
             } else {
                 $condition .= " AND Objid IN (0)";
             }
         }
         if (isset($_GET['Gender']) && $_GET['Gender']) {
             $genVal = $_GET['Gender'];
             if ($_GET['Gender'] == 1) {
                 $condition .= " AND Gender=0";
             } else {
                 if ($_GET['Gender'] == 2) {
                     $condition .= " AND Gender=1";
                 }
             }
         }
         if (isset($_GET['postsPerPage']) && $_GET['postsPerPage']) {
             $pageCount = $_GET['postsPerPage'];
         }
     }
     $criteria->condition = $condition;
     $count = Profile::model()->count($criteria);
     $pages = new CPagination($count);
     $pages->pageSize = $pageCount;
     $pages->applyLimit($criteria);
     $model = Profile::model()->findAll($criteria);
     $this->render('index', array('models' => $model, 'idLilst' => $idLilst, 'gender' => $genVal, 'minAge' => $minAge, 'maxAge' => $maxAge, 'pages' => $pages, 'pageCount' => $pageCount));
 }
 /**
  * @see Page::readData()
  */
 public function readData()
 {
     parent::readData();
     // get profile options
     require_once WCF_DIR . 'lib/data/user/option/UserOptions.class.php';
     $userOptions = new UserOptions();
     $this->categories = $userOptions->getOptionTree('profile', $this->frame->getUser());
     // move contact information and about me
     foreach ($this->categories as $category => $categoryData) {
         if ($category == 'profile.contact' || $category == 'profile.messenger') {
             foreach ($categoryData['options'] as $key => $option) {
                 if (isset($option['outputData'])) {
                     $this->contactInformation[] = $option['outputData'];
                 } else {
                     if (!empty($option['optionValue']) && (empty($option['outputClass']) || !$userOptions->getOutputObject($option['outputClass']) instanceof UserOptionOutputContactInformation)) {
                         $this->contactInformation[] = array('icon' => '', 'title' => WCF::getLanguage()->get('wcf.user.option.' . $option['optionName']), 'value' => $option['optionValue'], 'url' => '');
                     }
                 }
             }
             unset($this->categories[$category]);
         }
     }
     // add vcard link
     $this->contactInformation[] = array('icon' => StyleManager::getStyle()->getIconPath('vCardM.png'), 'title' => WCF::getLanguage()->get('wcf.user.profile.downloadVCard'), 'value' => StringUtil::encodeHTML($this->frame->getUser()->username), 'url' => 'index.php?page=VCard&amp;userID=' . $this->frame->getUserID() . SID_ARG_2ND);
     // add general informations
     // registration date
     $this->generalInformation[] = array('icon' => StyleManager::getStyle()->getIconPath('registerM.png'), 'title' => WCF::getLanguage()->get('wcf.user.registrationDate'), 'value' => DateUtil::formatTime(null, $this->frame->getUser()->registrationDate));
     // languages
     require_once WCF_DIR . 'lib/acp/form/UserOptionListForm.class.php';
     $languages = array();
     $availableLanguages = UserOptionListForm::getAvailableContentLanguages();
     if (!$this->frame->getUser()->languageIDs) {
         $this->languages = $availableLanguages;
     } else {
         $languageIDs = explode(',', $this->frame->getUser()->languageIDs);
         foreach ($languageIDs as $languageID) {
             if (isset($availableLanguages[$languageID])) {
                 $languages[$languageID] = $availableLanguages[$languageID];
             }
         }
         // sort languages
         StringUtil::sort($languages);
     }
     if (count($languages)) {
         $this->generalInformation[] = array('icon' => StyleManager::getStyle()->getIconPath('languageM.png'), 'title' => WCF::getLanguage()->get('wcf.user.profile.languages'), 'value' => implode(', ', $languages));
     }
     // last activity
     if (!$this->frame->getUser()->isOnline() && (!$this->frame->getUser()->invisible || WCF::getUser()->getPermission('admin.general.canViewInvisible')) && $this->frame->getUser()->lastActivityTime != 0) {
         $this->generalInformation[] = array('icon' => StyleManager::getStyle()->getIconPath('offlineM.png'), 'title' => WCF::getLanguage()->get('wcf.user.lastActivity'), 'value' => DateUtil::formatTime(null, $this->frame->getUser()->lastActivityTime, true));
     }
     // profile visits
     WCF::getTPL()->assign('user', $this->frame->getUser());
     $this->generalInformation[] = array('icon' => StyleManager::getStyle()->getIconPath('visitsM.png'), 'title' => WCF::getLanguage()->get('wcf.user.profile.hits'), 'value' => StringUtil::formatNumeric($this->frame->getUser()->profileHits) . ($this->frame->getUser()->getProfileAge() > 1 ? ' ' . WCF::getLanguage()->getDynamicVariable('wcf.user.profile.hitsPerDay') : ''));
     // get profile visitors
     $sql = "SELECT\t\tavatar.*, user_table.*, visitor.*\n\t\t\tFROM\t\twcf" . WCF_N . "_user_profile_visitor visitor\n\t\t\tLEFT JOIN \twcf" . WCF_N . "_user user_table\n\t\t\tON \t\t(user_table.userID = visitor.userID)\n\t\t\tLEFT JOIN \twcf" . WCF_N . "_avatar avatar\n\t\t\tON \t\t(avatar.avatarID = user_table.avatarID)\n\t\t\tWHERE\t\townerID = " . $this->frame->getUserID() . "\n\t\t\t\t\tAND user_table.userID IS NOT NULL\n\t\t\tORDER BY\ttime DESC";
     $result = WCF::getDB()->sendQuery($sql, 5);
     while ($row = WCF::getDB()->fetchArray($result)) {
         $this->profileVisitors[] = new UserProfile(null, $row);
     }
     // friends
     if (MODULE_MEMBERS_LIST == 1 && $this->frame->getUser()->shareWhitelist) {
         $sql = "SELECT\t\tavatar.*, user_table.*\n\t\t\t\tFROM\t\twcf" . WCF_N . "_user_whitelist friends\n\t\t\t\tLEFT JOIN \twcf" . WCF_N . "_user user_table\n\t\t\t\tON \t\t(user_table.userID = friends.whiteUserID)\n\t\t\t\tLEFT JOIN \twcf" . WCF_N . "_avatar avatar\n\t\t\t\tON \t\t(avatar.avatarID = user_table.avatarID)\n\t\t\t\tWHERE\t\tfriends.userID = " . $this->frame->getUserID() . "\n\t\t\t\t\t\tAND confirmed = 1\n\t\t\t\t\t\tAND user_table.userID IS NOT NULL\n\t\t\t\tORDER BY\tfriends.time DESC";
         $result = WCF::getDB()->sendQuery($sql, 5);
         while ($row = WCF::getDB()->fetchArray($result)) {
             $this->friends[] = new UserProfile(null, $row);
         }
     }
 }
Example #13
0
foreach ($attributes as $att_list) {
    ?>
	<div class="row" id="userOptions">
	  <label><?php 
    echo $att_list->Name;
    ?>
</label>
	  <?php 
    if ($att_list->Type == 'dropdown') {
        $selectValue = UserOptions::model()->getUserOptionValue($model->Objid, $att_list->Objid);
        $list = CHtml::listData(AttributeValues::model()->findAllByAttributes(array('AttributeId' => $att_list->Objid)), 'Objid', 'AttributeValue');
        echo $form->dropDownList($options_list, 'AttributeValueId[' . $att_list->Objid . ']', $list, array('empty' => '--Select a value--', 'options' => array($selectValue => array('selected' => true))));
    } else {
        if ($att_list->Type == 'checkbox') {
            $list = CHtml::listData(AttributeValues::model()->findAllByAttributes(array('AttributeId' => $att_list->Objid)), 'Objid', 'AttributeValue');
            $check_options = CHtml::listData(UserOptions::model()->findAllByAttributes(array('UserId' => $model->Objid, 'AttributeId' => $att_list->Objid)), 'AttributeValueId', 'AttributeValueId');
            $options_list->AttributeValueId = array($att_list->Objid => $check_options);
            echo $form->checkBoxList($options_list, 'AttributeValueId[' . $att_list->Objid . ']', $list);
        }
    }
    ?>
	</div>
	<?php 
    if ($temp % $i == 0) {
        echo '</div><div class="twoColumns">';
    }
    $temp++;
}
?>
  </div>
  <div class="clear"></div>
 public function GetTableStep($flightId)
 {
     $F = new Flight();
     $flightInfo = $F->GetFlightInfo($flightId);
     unset($F);
     $FDR = new Bru();
     $FDRinfo = $FDR->GetBruInfo($flightInfo['bruType']);
     unset($FDR);
     $userId = $this->_user->GetUserIdByName($this->_user->username);
     $O = new UserOptions();
     $step = $O->GetOptionValue($userId, 'printTableStep');
     unset($O);
     if ($step === null) {
         $step = 0;
     } else {
         $step = $step * $FDRinfo['stepDivider'];
     }
     return $step;
 }
Example #15
0
    ?>
"><th><?php 
    echo $attlist->Name;
    ?>
</th><td>
		<?php 
    if ($attlist->Type == 'dropdown') {
        $attValId = UserOptions::model()->findByAttributes(array('UserId' => $model->Objid, 'AttributeId' => $attlist->Objid));
        if ($attValId) {
            echo $attValId->attributeName->AttributeValue;
        } else {
            echo '----';
        }
    } else {
        if ($attlist->Type == 'checkbox') {
            $checkValId = UserOptions::model()->findAllByAttributes(array('UserId' => $model->Objid, 'AttributeId' => $attlist->Objid));
            if ($checkValId) {
                foreach ($checkValId as $cid) {
                    echo $cid->attributeName->AttributeValue . ',&nbsp;';
                }
            } else {
                echo '----';
            }
        } else {
            $text = UserText::model()->findByAttributes(array("UserId" => $model->Objid, "AttributeId" => $attlist->Objid));
            if ($text) {
                echo substr($text->Value, 0, 70) . '..';
            } else {
                echo '---';
            }
        }
Example #16
0
<?php

/*
   Copyright (C) 2004-2015 Kestas J. Kuliukas and Timothy Jones

	This file is part of webDiplomacy.

   webDiplomacy is free software: you can redistribute it and/or modify
   it under the terms of the GNU Affero General Public License as published by
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.

   webDiplomacy is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU Affero General Public License
   along with webDiplomacy.  If not, see <http://www.gnu.org/licenses/>.
*/
require_once 'header.php';
global $User;
header('Content-Type: application/javascript');
if ($User->options != null) {
    print $User->options->asJS();
} else {
    print UserOptions::defaultJS();
}