当前位置: 首页>>代码示例>>PHP>>正文


PHP UserList::model方法代码示例

本文整理汇总了PHP中UserList::model方法的典型用法代码示例。如果您正苦于以下问题:PHP UserList::model方法的具体用法?PHP UserList::model怎么用?PHP UserList::model使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UserList的用法示例。


在下文中一共展示了UserList::model方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionIndex

 public function actionIndex()
 {
     $taxModel = LbTax::model()->getTaxes();
     $list = UserList::model()->getList();
     $translate = Translate::model()->search();
     $translate = new Translate('search');
     $translate->unsetAttributes();
     // clear any default values
     if (isset($_GET['Translate'])) {
         $translate->attributes = $_GET['Translate'];
     }
     LBApplication::render($this, 'index', array('taxModel' => $taxModel, 'list' => $list, 'translate' => $translate));
     //		$this->render('index');
 }
开发者ID:nhuhtlb,项目名称:linxbooks,代码行数:14,代码来源:DefaultController.php

示例2: run

 public function run()
 {
     //We check the level of the user before to allow him to see the content
     if (isset($this->model->idCategory) && isset($this->filterLevel) && $this->model->idCategory != '') {
         $levelCategory = Category::model()->findByPk($this->model->idCategory);
         if ($levelCategory->level > $this->filterLevel) {
             Yii::app()->user->setFlash('forbiddenLevel', 'Sorry, to have access to this category you need to register a coin which belongs to this category.');
         }
     }
     //If the user makes a research by username, we shouldn't display the anonymous ones
     if (isset($this->model->username) && $this->model->username !== '') {
         $this->model->anonymous = 0;
     }
     //We get the generated criterias
     $criteria = $this->model->getCriteria();
     //We set up the number of Truth we want to display if necessary
     if (isset($this->model->limit)) {
         $criteria->limit = $this->model->limit;
     }
     //We choose the order of display
     $criteria->order = isset($this->model->order) && $this->model->order !== '' ? $this->model->order . " DESC " : " t.voteUp - t.voteDown DESC ";
     //Page manager
     $count = Truth::model()->levelFilter($this->filterLevel)->count($criteria);
     //Use the $this->limit in Pagination otherwise $pages->pageSize to $criteria overriding the $criteria->limit
     $pages = new CPagination(isset($this->model->limit) ? $this->model->limit : $count);
     $pages->pageSize = isset($this->model->limit) ? $this->model->limit : $this->itemsPerPage;
     $pages->applyLimit($criteria);
     //Get the datas
     $datas = Truth::model()->levelFilter($this->filterLevel)->findAll($criteria);
     //Manage favourites
     $modelUserList = new UserList();
     $userLists = CHtml::listData(array(), 'idUserList', 'name');
     if (!Yii::app()->user->isGuest) {
         $userLists = UserList::model()->findAllByAttributes(array('idUser' => Yii::app()->user->getId()));
         $userLists = CHtml::listData($userLists, 'idUserList', 'name');
     }
     //Manage send Challenges
     $friends = CHtml::listData(array(), 'idUser', 'username');
     if (!Yii::app()->user->isGuest) {
         $friends = CHtml::listData(Friend::getFriends(Yii::app()->user->getId()), 'idUser', 'username');
     }
     $this->render('truthList', array('datas' => $datas, 'pages' => $pages, 'userLists' => $userLists, 'friends' => $friends));
 }
开发者ID:rikohz,项目名称:Project1,代码行数:43,代码来源:TruthList.php

示例3: array

//            foreach ($recurring_arr as $data){
//                $recurring .='<option value="'.$data->lb_record_primary_key.'">'.$data['system_list_item_name'].'</option>';
//                $option_recurring = array(''=>'Choose Recurring')+$data;
//            }
//            echo $form->dropDownListRow($model, 'lb_expenses_recurring_id', $recurring);
//
$bank_accounts = LbBankAccount::model()->getBankAccount(Yii::app()->user->id);
$bank_account_arr = array();
if (count($bankaccounts) > 0) {
    foreach ($bankaccounts as $data_bank) {
        $bank_account_arr[$data_bank->lb_record_primary_key] = $data_bank->lb_bank_account;
    }
}
$option_bank_acc = array('' => 'Choose Bank Account');
if (UserList::model()->getItemsForListCode('BankAcount')) {
    $option_bank_acc += UserList::model()->getItemsForListCode('BankAcount');
}
echo $form->dropDownListRow($model, 'lb_expenses_bank_account_id', CHtml::listData($option_bank_acc, 'system_list_item_id', 'system_list_item_name'));
$arr_tax = LbTax::model()->getTaxes("", LbTax::LB_QUERY_RETURN_TYPE_MODELS_ARRAY);
//            echo '<pre>';
//            print_r($arr_tax);
$option_tax = '<option value="0">---</option>';
foreach ($arr_tax as $data) {
    $option_tax .= '<option value="' . $data['lb_record_primary_key'] . '">' . $data['lb_tax_value'] . '</option>';
}
echo '<div class="control-group" id="tax_0">';
echo CHtml::label('Taxes', 'LbExpenses_lb_tax_id', array('class' => 'control-label'));
echo '<div class="controls">';
// echo '<a href="#"  onClick="delete_tax(0); return false;" rel="tooltip" class="delete" data-original-title="Delete"><i class="icon-trash"></i></a>';
echo '<select name="LbExpensesTax[lb_tax_id][]" id="LbExpenses_lb_tax_id_0" onchange="changeTax(0);">' . $option_tax . '</select>';
echo '&nbsp;&nbsp;&nbsp;';
开发者ID:nhuhtlb,项目名称:linxbooks,代码行数:31,代码来源:_form.php

示例4: UpdateStatusInvoice

 function UpdateStatusInvoice($invoice_id)
 {
     $invoice = $this->getInvoiceByPk($invoice_id);
     $status_update = "";
     foreach ($invoice as $value) {
         $date = $value['lb_invoice_date'];
         $term = $value['lb_invoice_term_id'];
         $term_value = UserList::model()->getTerm($term);
         $status_update = $this->get_check_term($date, $term_value);
     }
     return $status_update;
 }
开发者ID:nhuhtlb,项目名称:linxbooks,代码行数:12,代码来源:LbInvoice.php

示例5: array

</a>
             </p>
        <?php 
} else {
    echo '<p class="note">Fields with <span class="required">*</span> are required.</p>';
}
$test = array();
$benefit = array();
if (isset($_GET['id'])) {
    $test = LbEmployeeSalary::model()->findAll('employee_id=' . $_GET['id']);
    $benefit = LbEmployeeBenefits::model()->findAll('employee_id=' . $_GET['id']);
    $salaryModel = new LbEmployeeSalary();
    $benefitModel = new LbEmployeeBenefits();
}
$salary = UserList::model()->getItemsForListCode('salary');
$benefit_employee = UserList::model()->getItemsForListCode('benefit');
$option_salary_update = CHtml::listData($salary, 'system_list_item_id', 'system_list_item_name');
$option_benefit_update = CHtml::listData($benefit_employee, 'system_list_item_id', 'system_list_item_name');
$option_salary = '<option value="0">choose salary</option>';
foreach ($salary as $data) {
    $option_salary .= '<option value="' . $data['system_list_item_id'] . '">' . $data['system_list_item_name'] . '</option>';
}
$option_benefit = '<option value="0">choose benefit</option>';
foreach ($benefit_employee as $value) {
    $option_benefit .= '<option value="' . $value['system_list_item_id'] . '">' . $value['system_list_item_name'] . '</option>';
}
echo $form->errorSummary($model);
echo '<div class="accordion" id="accordion2">';
/**
 * ============= BASIC INFORMATION
 */
开发者ID:nhuhtlb,项目名称:linxbooks,代码行数:31,代码来源:_form.php

示例6: array

$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'lb-expenses-form', 'enableAjaxValidation' => true, 'type' => 'horizontal', 'htmlOptions' => array('enctype' => 'multipart/form-data', 'onsubmit' => "validation();")));
?>

	<p class="note">Fields with <span class="required">*</span> are required.</p>

	
     
        
        <?php 
echo $form->hiddenField($model, 'lb_record_primary_key');
?>
        
        <?php 
$ExpensesNo = LbExpenses::model()->FormatExpensesNo(LbExpenses::model()->getExpensesNextNum());
echo $form->textFieldRow($model, 'lb_expenses_no', array('class' => 'span3', 'value' => $ExpensesNo));
$category_arr = UserList::model()->getItemsForListCode('expenses_category');
echo $form->dropDownListRow($model, 'lb_category_id', CHtml::listData($category_arr, 'system_list_item_id', 'system_list_item_name'));
echo $form->textFieldRow($model, 'lb_expenses_date', array('hint' => 'Format: dd-mm-yyyy, e.g. 31-12-2013', 'value' => $model->lb_expenses_date ? date('d-m-Y', strtotime($model->lb_expenses_date)) : date('d-m-Y')));
echo $form->textFieldRow($model, 'lb_expenses_amount', array('class' => 'span3', 'value' => '0.00'));
echo '<span id="vacation"></span>';
echo '<hr/>';
$customer_arr = LbCustomer::model()->getCompanies($sort = 'lb_customer_name ASC', LbCustomer::LB_QUERY_RETURN_TYPE_DROPDOWN_ARRAY);
$option_customer = $customer_arr;
//            echo '<div class="control-group">';
//            echo CHtml::label('Customer', 'LbExpenses_lb_customer_id',array('class'=>'control-label'));
//            echo '<div class="controls">';
//            echo CHtml::dropDownList('LbExpenses_lb_customer_id', '', $option_customer, array('multiple'=>true));
////            echo Chosen::activeMultiSelect($model,'lb_expenses_amount', $option_customer, array('class'=>'span6'));
//            echo '</div>';
//            echo '</div>';
echo $form->dropDownListRow($customerModel, 'lb_customer_id', $option_customer, array('multiple' => true));
开发者ID:keyeMyria,项目名称:linxbooks,代码行数:31,代码来源:_form.php

示例7: array

//
//    echo '</div><br/>';
//$this->widget('zii.widgets.CDetailView', array(
//	'data'=>$model,
//	'attributes'=>array(
//		'lb_record_primary_key',
//		'lb_category_id',
//		'lb_expenses_amount',
//		'lb_expenses_date',
//		'lb_expenses_recurring_id',
//		'lb_expenses_brank_account_id',
//		'lb_expenses_note',
//	),
//));
//echo '<div style="float: left; width: 49%;">';
$this->widget('editable.EditableDetailView', array('id' => 'expenses-detail', 'data' => $model, 'url' => $model->getActionURL('ajaxUpdateField'), 'placement' => 'right', 'attributes' => array(array('name' => 'lb_expenses_no', 'editable' => false), array('name' => 'lb_category_id', 'editable' => array('type' => 'select', 'source' => array('0' => 'Choose Category') + CHtml::listData(SystemList::model()->getItemsForListCode('expenses_category'), 'system_list_item_id', 'system_list_item_name'))), array('name' => 'lb_expenses_date', 'editable' => array('type' => 'date', 'viewformat' => 'dd-mm-yyyy', 'format' => 'yyyy-mm-dd')), 'lb_expenses_amount', array('name' => 'lb_expenses_note', 'editable' => array('type' => 'textarea')), array('name' => 'lb_expenses_recurring_id', 'editable' => array('type' => 'select', 'source' => array('0' => 'Choose Recurring') + CHtml::listData(UserList::model()->getItemsForListCode('recurring'), 'system_list_item_id', 'system_list_item_name'))), array('name' => 'lb_expenses_bank_account_id', 'editable' => array('type' => 'select', 'source' => array('' => 'Choose bank account') + CHtml::listData(UserList::model()->getItemsForListCode('BankAcount'), 'system_list_item_id', 'system_list_item_name'))))));
$customers = LbExpensesCustomer::model()->getCustomerExpenses($model->lb_record_primary_key);
$customer_view = '';
if (count($customers) > 0) {
    foreach ($customers as $cus) {
        $client = LbCustomer::model()->findByPk($cus->lb_customer_id);
        $customer_view .= $client['lb_customer_name'] . '; ';
    }
}
$invoices = LbExpensesInvoice::model()->getExpensesInvoice($model->lb_record_primary_key);
$invoice_view = '';
if (count($invoices) > 0) {
    foreach ($invoices as $inv) {
        $invoice = LbInvoice::model()->findByPk($inv->lb_invoice_id);
        $invoice_view .= $invoice['lb_invoice_no'] . '; ';
    }
开发者ID:nhuhtlb,项目名称:linxbooks,代码行数:31,代码来源:view.php

示例8: number_format

    $PDFSalaryEmployee .= '<td align="center">$' . number_format($value->salary_amount, 2) . '</td>';
    $PDFSalaryEmployee .= '</tr>';
    $salary += $value->salary_amount;
}
$PDFSalaryEmployee .= '            
            </table>
            <h4 ">Benefits Detail:</h4>
            <table border="1" style="width:100%;margin-top:20px;margin-left:10px;" cellpadding="0" cellspacing="0">';
$PDFSalaryEmployee .= '<thead>
                        
                        <tr style="font-weight:bold;" align="center">                        
                           
                            <td width="350" class="lb-grid-header">' . Yii::t('lang', 'Benefit Name') . '</td>
                            <td width="350" class="lb-grid-header">' . Yii::t('lang', 'Benefit Amount') . '</td>
                            
                        </tr>
                    </thead>';
$a = LbEmployeeBenefits::model()->getBenefitsByEmployee($employee_id);
$benefits = 0;
foreach ($a as $value) {
    $benefit_name = UserList::model()->findByPk($value->benefit_name)['system_list_item_name'];
    $PDFSalaryEmployee .= '<tr>';
    $PDFSalaryEmployee .= '<td align="center">' . $benefit_name . '</td>';
    $PDFSalaryEmployee .= '<td align="center">$' . number_format($value->benefit_amount, 2) . '</td>';
    $PDFSalaryEmployee .= '</tr>';
    $benefits += $value->benefit_amount;
}
$PDFSalaryEmployee .= '
            </table>';
$PDFSalaryEmployee .= '<div style="margin-left:500px; margin-top:20px; width:30%; border: 1px solid black">' . '<table style="text-align:right;width:100%;">' . '<tr>' . '<td style="text-align:left;padding:6px;"><b> Salary:</b></td>' . '<td style="text-align:right;padding:6px;"><b>$' . number_format($salary, 2) . '</b></td>' . '</tr>' . '<tr>' . '<td style="text-align:left;padding:6px;"><b>Benefits:</b></td>' . '<td style="text-align:right;padding:6px;"><b>$' . number_format($benefits, 2) . '</b></td>' . '</tr>' . '<tr>' . '<td style="text-align:left;padding:6px;"><b>Total Salary:</b></td>' . '<td style="text-align:right;padding:6px;"><b>$' . number_format($salary - $benefits, 2) . '</b></td>' . '</tr>' . '</table>' . '</div>';
echo $PDFSalaryEmployee;
开发者ID:nhuhtlb,项目名称:linxbooks,代码行数:31,代码来源:PDFSalaryEmployee.php

示例9: array

$term = UserList::model()->getItemsForListCode('term');
$option_term = CHtml::listData($term, 'system_list_item_id', 'system_list_item_name');
echo '<div id="invoice-basic-info-container" class="lb_div_InvoiceInfo infoQuotation">';
echo '<table class="items table lb_table_InvoiceInfo">';
echo '<tbody>';
echo '<tr class="odd">';
echo '<th class="lb_th_InvoiceInfo">Date</th>';
echo '<td class="lb_td_InoviceInfo">';
$this->widget('editable.EditableField', array('type' => 'date', 'model' => $model, 'attribute' => 'lb_quotation_date', 'url' => $model->getActionURLNormalized('ajaxUpdateField'), 'placement' => 'right', 'format' => 'yyyy-mm-dd', 'viewformat' => 'dd M yyyy'));
echo '</td>';
echo '</tr>';
echo '<tr class="odd">';
echo '<th class="lb_th_InvoiceInfo">Term</th>';
echo '<td class="lb_td_InoviceInfo">';
//echo $form->dropDownList($model,'lb_quotation_term',$option_term,array('empty'=>$model->lb_quotation_term,'name'=>'lb_quotation_term[]','style'=>'width:100px;'));
$this->widget('editable.EditableField', array('type' => 'select', 'model' => $model, 'attribute' => 'lb_quotation_term', 'url' => $model->getActionURLNormalized('ajaxUpdateField'), 'source' => Editable::source(UserList::model()->getItemsForListCode('term'), 'system_list_item_id', 'system_list_item_name'), 'placement' => 'left'));
echo '</td>';
echo '</tr>';
echo '<tr class="odd">';
echo '<th class="lb_th_InvoiceInfo">Currency</th>';
echo '<td class="lb_td_InoviceInfo">';
// echo LbGenera::model()->getGeneraSubscription()->lb_genera_currency_symbol;
$this->widget('editable.EditableField', array('type' => 'select', 'model' => $model, 'attribute' => 'lb_quotation_currency', 'url' => $model->getActionURLNormalized('ajaxUpdateField'), 'emptytext' => LbGenera::model()->getGeneraSubscription()->lb_genera_currency_symbol, 'source' => CHtml::listData(LbGenera::model()->getCurrency("", LbGenera::LB_QUERY_RETURN_TYPE_MODELS_ARRAY), function ($gene) {
    return "{$gene->lb_record_primary_key}";
}, function ($gene) {
    return "{$gene->lb_genera_currency_symbol}";
}) + array("-1" => "-- Add new currency --"), 'placement' => 'left', 'htmlOptions' => array('id' => 'LbQuotation_quotation_genera_id_' . $model->lb_record_primary_key), 'onShown' => 'js: function() {
                            var $tip = $(this).data("editableContainer").tip();
                            var dropdown = $tip.find("select");
                            $(dropdown).bind("change", function(e){
                                onChangeCurrencyDropdown(e,' . $model->lb_record_primary_key . ');
开发者ID:nhuhtlb,项目名称:linxbooks,代码行数:31,代码来源:_page_header.php

示例10: array

<?php

$model = UserList::model()->search();
$this->widget('bootstrap.widgets.TbGridView', array('id' => 'lb_list', 'dataProvider' => $model, 'htmlOptions' => array('class' => 'items table table-bordered', 'width' => '98%'), 'columns' => array(array('name' => 'List', 'type' => 'raw', 'value' => 'CHtml::link($data->system_list_code,Yii::app()->createUrl("configuration/list_item",array("list"=>$data->system_list_code)))'), array('class' => 'CButtonColumn', 'template' => '{update}{delete}', 'buttons' => array('delete' => array('url' => 'Yii::app()->createUrl("/configuration/deleteList",array("list"=>$data->system_list_code))'), 'update' => array('url' => 'Yii::app()->createUrl("/configuration/updateList",array("list"=>$data->system_list_code))'))))));
echo '<div class="btn-toolbar" id ="new_item">';
LBApplicationUI::newButton('New List', array());
echo '</div>';
?>
    
    
    

<div hidden ="true" id="form-new-item" class="accordion-body collapse in">
    <input type="text" value="" id="new"><lable id ="err"></lable>
                    <?php 
//echo '<br>';
?>
                    <?php 
echo '<div id ="newItem">';
echo CHtml::Button('Insert', array('onclick' => 'load_item();return false;', 'class' => 'btn', 'style' => 'margin-top:-3px;'));
echo '</div>';
?>
                
</div><!-- form -->
<style>
    .table
    {
        width: 98%;
    }
    </style>
<script>
开发者ID:nhuhtlb,项目名称:linxbooks,代码行数:31,代码来源:_list_item.php

示例11: isset

<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
$financial = UserList::model()->getItemsList('financial_year');
$financial_day = isset($financial[0]['system_list_item_day']) ? $financial[0]['system_list_item_day'] : "";
$financial_month = isset($financial[0]['system_list_item_month']) ? $financial[0]['system_list_item_month'] : "";
$now = getdate();
$year_prev = $now["year"] - 1;
$year_next = $now["year"] + 1;
//$financial_year = $financial_day."-".$financial_month."-".$now["year"];
$financial_year = $now["year"] . "-" . $financial_month . "-" . $financial_day;
$date_now = date('Y-m-d');
$financial_prev_year = $year_prev . "-" . $financial_month . "-" . $financial_day;
$financial_next_year = $year_next . "-" . $financial_month . "-" . $financial_day;
//if(strtotime($financial_year) < strtotime($date_now)){
//    //$financial_old_year = $financial_day."-".$financial_month."-".$year_old;
//    $financial_prev_year = $year_prev."-".$financial_month."-".$financial_day;
//    $total_Payment = LbInvoice::CURRENCY_SYMBOL.number_format(LbPayment::model()->getTotalPayment($financial_year,$financial_prev_year),2);
//}else{
//    $financial_next_year = $year_next."-".$financial_month."-".$financial_day;
//    $total_Payment = LbInvoice::CURRENCY_SYMBOL.number_format(LbPayment::model()->getTotalPaymentFinancial($financial_year,$financial_next_year),2);
//}
?>

    
<div class="col-lg" >
    <div class="panel-header-summary"><h4 >Outstanding</h4></div>
开发者ID:nhuhtlb,项目名称:linxbooks,代码行数:31,代码来源:dashboard_summary.php

示例12: actionAjaxUpdateItem

 public function actionAjaxUpdateItem()
 {
     $pk = $_POST['pk'];
     $name = $_POST['name'];
     $value = $_POST['value'];
     $model = UserList::model()->findByPk($pk);
     $listCode = $model->system_list_code;
     if ($name == 'system_list_item_name') {
         $model->system_list_item_name = $value;
         $model->system_list_item_code = $listCode . '_' . $value;
     }
     $model->update();
     //            return false;
 }
开发者ID:Lucerin,项目名称:Yii-projects,代码行数:14,代码来源:ConfigurationController.php

示例13: array

}
if (count($invoice_arr) <= 0) {
    $option_invoice = array('' => 'Choose Invoice');
} else {
    $option_invoice = $invoice_arr;
}
echo '<div class="control-group">';
echo CHtml::label('Invoices', 'LbExpenses_lb_invoice_id', array('class' => 'control-label'));
echo '<div class="controls">';
echo CHtml::dropDownList('LbExpensesInvoice[lb_invoice_id][]', '', $option_invoice, array('multiple' => true));
//            echo Chosen::activeMultiSelect($model,'lb_expenses_amount', $option_customer, array('class'=>'span6'));
echo '</div>';
echo '</div>';
//            echo $form->dropDownListRow($invoiceModel, 'lb_invoice_id', $option_invoice, array('multiple'=>true));
echo $form->textAreaRow($model, 'lb_expenses_note', array('rows' => '3', 'cols' => '40', 'style' => 'width:210px;'));
$recurring = UserList::model()->getItemsForListCode('recurring');
$option_recurring = array('' => 'Choose Recurring') + $recurring;
echo $form->dropDownListRow($model, 'lb_expenses_recurring_id', CHtml::listData($option_recurring, 'system_list_item_id', 'system_list_item_name'));
//            foreach ($recurring_arr as $data){
//                $recurring .='<option value="'.$data->lb_record_primary_key.'">'.$data['system_list_item_name'].'</option>';
//                $option_recurring = array(''=>'Choose Recurring')+$data;
//            }
//            echo $form->dropDownListRow($model, 'lb_expenses_recurring_id', $recurring);
//
$bank_accounts = LbBankAccount::model()->getBankAccount(Yii::app()->user->id);
$bank_account_arr = array();
if (count($bankaccounts) > 0) {
    foreach ($bankaccounts as $data_bank) {
        $bank_account_arr[$data_bank->lb_record_primary_key] = $data_bank->lb_bank_account;
    }
}
开发者ID:Lucerin,项目名称:Yii-projects,代码行数:31,代码来源:_form.php

示例14: run

 public function run()
 {
     $wallOwner = User::model()->with('scoreTruth', 'scoreDare')->findByPk($this->idWallOwner);
     //To display notifications from friends
     if ($this->withFriendsInformations === 1) {
         $friends = $wallOwner->getIdFriends();
         $friends[] = $this->idWallOwner;
     }
     //Add message to the Wall
     $model = new UserWall();
     if (isset($_POST['Userwall'])) {
         $model->attributes = $_POST['Userwall'];
         $model->idUserFrom = $this->idCurrentUser;
         $model->idUserTo = $this->idWallOwner;
         $model->createDate = date('Y-m-d, H:i:s');
         $model->save();
         $model->content = '';
     }
     //Initialiation of the array
     $wall = array();
     $i = 0;
     //Get Wall Messages and add them to the Wall array()
     if ($this->withWallMessages == 1) {
         $criteria = new CDbCriteria();
         $criteria->addCondition('t.idUserTo = :idUser');
         $criteria->params = array(':idUser' => $this->idWallOwner);
         $criteria->order = 'createDate DESC';
         $wallComments = UserWall::model()->with('userFrom', 'userFrom.scoreTruth', 'userFrom.scoreDare')->findAll($criteria);
         foreach ($wallComments as $row) {
             $wall[$i]['type'] = "WallMessage";
             $wall[$i]['id'] = $row->idUserWall;
             $wall[$i]['content'] = $row->content;
             $wall[$i]['createDate'] = $row->createDate;
             $wall[$i]['userPicture'] = $row->userFrom->profilePicture . '_mini' . $row->userFrom->profilePictureExtension;
             $wall[$i]['category'] = null;
             $wall[$i]['vote'] = null;
             $wall[$i]['nbFavourite'] = null;
             $wall[$i]['nbComment'] = null;
             $wall[$i]['idDisplayUser'] = $row->userFrom->idUser;
             $wall[$i]['displayUsername'] = $row->userFrom->username;
             $wall[$i]['pictureChallengeDareMini'] = null;
             $wall[$i]['pictureChallengeDare'] = null;
             $wall[$i]['challengeTruthOrCommentDare'] = null;
             $wall[$i]['rankTruth'] = MyFunctions::getTruthRankName($row->userFrom->scoreTruth->score);
             $wall[$i]['rankDare'] = MyFunctions::getDareRankName($row->userFrom->scoreDare->score);
             $i++;
         }
     }
     //Get Challenges Notifications and add them to the Wall array()
     $criteria = new CDbCriteria();
     $criteria->addCondition('t.status = 1 AND (t.private = 0 OR (t.idUserFrom = :idCurrentUser OR t.idUserTo = :idCurrentUser))');
     $criteria->params = array(':idCurrentUser' => $this->idCurrentUser);
     if ($this->withFriendsInformations === 1) {
         $criteria->addInCondition('t.idUserTo', $friends);
     } else {
         $criteria->addCondition('t.idUserTo = :idUser');
         $criteria->params[':idUser'] = $this->idWallOwner;
     }
     if (isset($this->filterLevel)) {
         $criteria->addCondition("(categoryTruth.level IS NOT NULL AND categoryTruth.level <= {$this->filterLevel}) OR (categoryDare.level IS NOT NULL AND categoryDare.level <= {$this->filterLevel})");
     }
     $challenges = Challenge::model()->with('userTo', 'truth', 'dare', 'truth.category', 'dare.category', 'userTo.scoreTruth', 'userTo.scoreDare')->findAll($criteria);
     foreach ($challenges as $row) {
         $wall[$i]['type'] = $row->idTruth === null ? "ChallengeDare" : "ChallengeTruth";
         $wall[$i]['id'] = $row->idChallenge;
         $wall[$i]['content'] = isset($row->truth) ? $row->answer : $row->dare->dare;
         $wall[$i]['createDate'] = $row->createDate;
         $wall[$i]['userPicture'] = $row->userTo->profilePicture . '_mini' . $row->userTo->profilePictureExtension;
         $wall[$i]['category'] = isset($row->truth) ? $row->truth->category->category : $row->dare->category->category;
         $wall[$i]['vote'] = $row->voteUp - $row->voteDown;
         $wall[$i]['nbFavourite'] = 0;
         $wall[$i]['nbComment'] = 0;
         $wall[$i]['idDisplayUser'] = $row->userTo->idUser;
         $wall[$i]['displayUsername'] = $row->userTo->username;
         $wall[$i]['pictureChallengeDareMini'] = $row->pictureName . "_mini" . $row->pictureExtension;
         $wall[$i]['pictureChallengeDare'] = $row->pictureName . "_original" . $row->pictureExtension;
         $wall[$i]['challengeTruthOrCommentDare'] = isset($row->truth) ? $row->truth->truth : $row->answer;
         $wall[$i]['rankTruth'] = MyFunctions::getTruthRankName($row->userTo->scoreTruth->score);
         $wall[$i]['rankDare'] = MyFunctions::getDareRankName($row->userTo->scoreDare->score);
         $i++;
     }
     //Get Truths and add them to the Wall array()
     $truth = new Truth();
     if (isset($this->filterLevel)) {
         $truth->levelMax = $this->filterLevel;
     }
     $criteria = $truth->getCriteria();
     if ($this->withFriendsInformations === 1) {
         $criteria->addInCondition('t.idUser', $friends);
     } else {
         $criteria->addCondition('t.idUser = :idUser');
         $criteria->params[':idUser'] = $this->idWallOwner;
     }
     $truths = Truth::model()->notAnonymous()->findAll($criteria);
     foreach ($truths as $row) {
         $wall[$i]['type'] = "Truth";
         $wall[$i]['id'] = $row->idTruth;
         $wall[$i]['content'] = $row->truth;
         $wall[$i]['createDate'] = $row->dateSubmit;
         $wall[$i]['userPicture'] = $row->user->profilePicture . '_mini' . $row->user->profilePictureExtension;
//.........这里部分代码省略.........
开发者ID:rikohz,项目名称:Project1,代码行数:101,代码来源:UserWallWidget.php

示例15: actionAddFavourite

 public function actionAddFavourite()
 {
     if (isset($_POST['idUserList']) && (isset($_POST['idTruth']) || isset($_POST['idDare']))) {
         //Verify that the person that add to favourite is the owner of the list
         $model = UserList::model()->findByPk($_POST['idUserList']);
         if ($model->idUser == Yii::app()->user->getId()) {
             $model = new Userlistcontent();
             $model->idUserList = $_POST['idUserList'];
             if (isset($_POST['idTruth'])) {
                 $model->idTruth = $_POST['idTruth'];
             }
             if (isset($_POST['idDare'])) {
                 $model->idDare = $_POST['idDare'];
             }
             if ($model->save()) {
                 echo "SUCCESS";
                 $ttotot = "rr";
                 $ttotot = "rr";
             }
         }
     }
 }
开发者ID:rikohz,项目名称:Project1,代码行数:22,代码来源:SiteController.php


注:本文中的UserList::model方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。