本文整理汇总了PHP中Clients::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Clients::model方法的具体用法?PHP Clients::model怎么用?PHP Clients::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Clients
的用法示例。
在下文中一共展示了Clients::model方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getClient
public function getClient($id)
{
if (empty($id)) {
return NULL;
}
$dept_id = Clients::model()->getScaler('client_name', '`id`=:t1', array(':t1' => $id));
return !empty($dept_id) ? $dept_id : NULL;
}
示例2: check_auth
/**
* Check Auth_Code rule
*/
public function check_auth() {
$client = Clients::model()->findByPk($this->Client_ID);
if($client) {
$company = Companies::model()->findByPk($client->Company_ID);
if ($company->Auth_Code != $this->Auth_Code) {
$this->addError('Auth_Code','Invalid Authorization Code');
}
} else {
$this->addError('Auth_Code',"Company with this Authorization Code doesn't exists");
}
}
示例3: Header
function Header()
{
$client = Clients::model()->with('company')->findByPk(Yii::app()->user->clientID);
$project = Projects::model()->findByPk(Yii::app()->user->projectID);
$projectId = Yii::app()->user->projectID;
//Logo
//$this->Image('logo_pb.png',10,8,33);
//Arial bold 15
$this->SetFont('Arial','',12);
$this->SetXY(5,5);
//$this->Cell(20,10,$client->company->Company_Name.' - '.$project->Project_Name ,0,0,'L');
$this->SetXY(5,5);
$this->SetFont('Arial','B',12);
$this->Cell(0,0, Helper::shortenString($client->company->Company_Name,30).' - '.Helper::shortenString($project->Project_Name,20),0,1,'L');
$this->SetFont('Arial','',12);
$this->SetXY(5,10);
$this->Cell(0,0,"Export Summary:",0,1,'L');
// $this->Text(0,10,"AP Batch Summary Report: ");
$this->SetFont('Arial','B',12);
$this->SetXY(140,5);
if($this->doc_type == 'AP') {
$this->Cell(0,0,"AP Batch Summary Report:",0,1,'R');
} else {
$this->Cell(0,0,"PO Batch Summary Report:",0,1,'R');
}
$this->SetFont('Arial','',12);
$this->SetXY(140,10);
$this->Cell(0,0,"Batch ".$this->batch_id,0,1,'R');
//$this->SetXY(120,5);
//$this->Cell(0,0,"AP Batch Summary Report: ",0,0,'R');
$this->Line(5,14,205,14);
$this->Ln(5);
}
示例4: appendCompany
public function appendCompany($client_id){
$client = Clients::model()->with('company.adreses')->findByPk($client_id);
$company = $client->company;
$xml_company = $this->xml->createElement("company");
$xml_row = $this->xml->createElement("row");
foreach ($company->attributes as $key => $value) {
$xml_field = $this->xml->createElement("field",htmlentities($value,ENT_QUOTES | 'ENT_XML1'));
$xml_field->setAttribute('name', $key);
$xml_row->appendChild($xml_field);
}
$xml_company->appendChild($xml_row);
$xml_adreses = $this->xml->createElement("addresses");
foreach ($company->adreses as $address) {
$xml_address = $this->xml->createElement("address");
$xml_row = $this->xml->createElement("row");
foreach ($address->attributes as $key=>$value) {
$xml_field = $this->xml->createElement("field",htmlentities($value,ENT_QUOTES | 'ENT_XML1'));
$xml_field->setAttribute('name', $key);
$xml_row->appendChild($xml_field);
}
$xml_address->appendChild($xml_row);
}
$xml_adreses->appendChild($xml_address);
$xml_company->appendChild($xml_adreses);
$this->wrapper->appendChild($xml_company);
}
示例5: array
<?php
$this->breadcrumbs = array('Работы' => array('index'), 'Управление');
$this->menu = array(array('label' => 'Создать работу', 'url' => array('create')));
Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\t\$('.search-form').toggle();\n\treturn false;\n});\n\$('.search-form form').submit(function(){\n\t\$.fn.yiiGridView.update('works-grid', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n");
?>
<h1>Управление работами/услугами</h1>
<?php
$this->widget('application.extensions.yii-flash.Flash', array('keys' => array('success', 'error', 'notice'), 'htmlOptions' => array('class' => 'flash')));
?>
<!-- flashes -->
<p>
Можно использовать (<b><</b>, <b><=</b>, <b>></b>, <b>>=</b>, <b><></b> или <b>=</b>).
</p>
<?php
echo CHtml::link('Advanced Search', '#', array('class' => 'search-button'));
?>
<div class="search-form" style="display:none">
<?php
$this->renderPartial('_search', array('model' => $model));
?>
</div><!-- search-form -->
<?php
$this->widget('zii.widgets.grid.CGridView', array('id' => 'works-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array('id', 'date', array('name' => 'client_id', 'value' => '$data->client->name', 'filter' => CHtml::listData(Clients::model()->findAll(array('order' => 'name')), 'id', 'name')), array('name' => 'order_id', 'value' => '$data->order->name', 'filter' => CHtml::listData(Orders::model()->findAll(array('order' => 'name')), 'id', 'name')), array('name' => 'act_id', 'value' => '!is_null($data->act_id)?$data->act->num:null', 'filter' => CHtml::listData(Acts::model()->findAll(array('order' => 'num')), 'id', 'num')), 'name', 'unit', 'cost', 'quantity', 'sum', 'location', array('class' => 'MyButtonColumn'))));
示例6: beforeAction
/**
* This method is invoked right before an action is to be executed (after all possible filters.)
* @param CAction $action the action to be executed.
* @return boolean whether the action should be executed
*/
public function beforeAction($action)
{
$response = false;
//if (Yii::app()->user->getState('project_selected') != null)
//{
if (in_array($action->id, array('view', 'update'))) {
$response = Clients::model()->countClientsByAccount((int) $_GET['id'], Yii::app()->user->Accountid) > 0 ? true : false;
} else {
$response = true;
}
//}
//else
// return false;
if (!$response) {
throw new CHttpException(403, Yii::t('site', '403_Error'));
} else {
return $response;
}
}
示例7: actionIndex
/**
* Lists all models.
*/
public function actionIndex()
{
if (isset($_POST['oper']) && $_POST['oper'] == 'edit') {
$id = intval($_POST["id"]);
$video = Videos::model()->findByPk($id);
if ($video) {
$error_string= '';
$video->Video_Title =$_POST['Video_Title'] ? $_POST["Video_Title"] : null;
$video->Video_Log_Line =$_POST['Video_Log_Line'] ? $_POST["Video_Log_Line"] : null;
$video->Video_Desc =$_POST['Video_Desc'] ? $_POST["Video_Desc"] : null;
$video->Link_Title =$_POST['Link_Title'] ? $_POST["Link_Title"] : null;
$video->Sort_Order =$_POST['Sort_Order'] ? $_POST["Sort_Order"] : null;
$video->Video_URL =$_POST['Video_URL'] ? addslashes($_POST['Video_URL']) : null;
$video->Video_Password =$_POST['Video_Password'] ? $_POST["Video_Password"] : null;
$video->Visibility =$_POST['Visibility'] ? $_POST["Visibility"] : null;
if (intval($_POST['Visibility'])==4) {
$client_id = intval($_POST['Clients_Client_ID']);
$client = Clients::model()->findByPk($client_id);
if (!$client) {
$error_string = 'Client_ID should be real';
}
}
if (intval($_POST['Visibility'])==5) {
$client_id = intval($_POST['Clients_Client_ID']);
$project_id = intval($_POST['Clients_Client_ID']);
$project = Projects::model()->findByAttributes(array(
'Project_ID'=>$project_id,
'Client_ID'=>$client_id
));
if (!$project) {
$error_string = 'There is no project for such Client_ID and Project_ID';
}
}
$video->Clients_Client_ID =$_POST['Clients_Client_ID'] ? $_POST["Clients_Client_ID"] : null;
$video->Project_ID =$_POST['Project_ID'] ? $_POST["Project_ID"] : null;
if ($video->validate() && $error_string == '') {
$video->save();
echo "video\n";
} else {
die($error_string);
}
}
die;
}
if (isset($_POST['oper']) && $_POST['oper'] == 'add') {
// var_dump($_POST);die;
$error_string= '';
$video = new Videos();
$video->Video_Title =$_POST['Video_Title'];
$video->Video_Log_Line =$_POST['Video_Log_Line'];
$video->Video_Desc =$_POST['Video_Desc'];
$video->Link_Title =$_POST['Link_Title'];
$video->Video_URL =addslashes($_POST['Video_URL']);
$video->Video_Password =$_POST['Video_Password'];
$video->Sort_Order =$_POST['Sort_Order'] ? $_POST["Sort_Order"] : 1;
if (intval($_POST['Visibility'])==4) {
$client_id = intval($_POST['Clients_Client_ID']);
$client = Clients::model()->findByPk($client_id);
if (!$client) {
$error_string = 'Client_ID should be real';
}
}
if (intval($_POST['Visibility'])==5) {
$client_id = intval($_POST['Clients_Client_ID']);
$project_id = intval($_POST['Clients_Client_ID']);
$project = Projects::model()->findByAttributes(array(
'Project_ID'=>$project_id,
'Client_ID'=>$client_id
));
if (!$project) {
$error_string = 'There is no project for such Client_ID and Project_ID';
}
}
//.........这里部分代码省略.........
示例8: getVendorsToApproveToSession
/**
* Get vendors to approve to session
* @return array
*/
public static function getVendorsToApproveToSession()
{
$vendorsList = array();
$client = Clients::model()->with('vendors_list')->findByPk(Yii::app()->user->clientID);
if (isset($client->vendors_list)) {
$vendors = $client->vendors_list;
} else {
$vendors = array();
}
$i = 1;
foreach($vendors as $vendor) {
$vendorsList[$i] = $vendor->Vendor_ID;
$i++;
}
return $vendorsList;
}
示例9: loadModel
public function loadModel($id)
{
$model = Clients::model()->findByPk($id);
if ($model === null) {
throw new CHttpException(404, 'The requested page does not exist.');
}
return $model;
}
示例10: _prepare_body
private function _prepare_body($mdl = null)
{
$return_msg = '';
if (is_null($mdl)) {
if (!isset($_POST['act_id']) and !isset($_POST['order_id']) and empty($_POST['works']) and !isset($_POST['client_id']) and !isset($_POST['template_id']) and !isset($_POST['date']) and !isset($_POST['sum']) and !isset($_POST['num'])) {
die("Необходимых данных недостаточно </br>");
}
$date = $_POST['date'];
$sum = $_POST['sum'];
$num = (int) $_POST['num'];
$act_id = (int) $_POST['act_id'];
$order_id = (int) $_POST['order_id'];
$works = $_POST['works'];
$client_id = (int) $_POST['client_id'];
$template_id = (int) $_POST['template_id'];
} else {
$date = $mdl->date;
$sum = $mdl->sum;
$num = $mdl->num;
$act_id = $mdl->id;
$order_id = $mdl->order_id;
$works = false;
$client_id = $mdl->client_id;
$template_id = $mdl->template_id;
}
$data['act']['date'] = $date;
$data['act']['sum'] = $sum;
$data['act']['num'] = $num;
if (!is_array($order_pos = Works::model()->worksByOrder($order_id, $act_id, $works))) {
$return_msg .= "Невозможно получить список работ </br>";
}
$data['works'] = $order_pos;
// parse_str($_POST['works']);
// Dumper::d($Works);die;
$data['contract'] = Contracts::model()->findByPk($order_id, array('select' => 'date, num'));
// if (is_null($data['contract'] = Contracts::model()->findByPk((int) $_POST['order_id'], array('select' => 'date, num')))) {
// $return_msg .= "Невозможно получить данные договора \n";
// }
if (is_null($data['client'] = Clients::model()->findByPk($client_id))) {
$return_msg .= "Невозможно получить данные клиента \n";
}
if (!is_array($data['settings'] = Config::model()->get_settings())) {
$return_msg .= "Невозможно получить основные параметры \n";
}
$body = $this->_tmpl_body($data, Acts::model()->get_act_tmpl($template_id));
if ($body == '') {
$return_msg .= "Невозможно сформировать шаблон \n";
}
if ($return_msg == '') {
echo $body;
} else {
echo $return_msg;
}
}
示例11: array
<div class="row">
<?php
echo $form->labelEx($model, 'name');
?>
<?php
echo $form->textField($model, 'name', array('size' => 60, 'maxlength' => 255));
?>
</div>
<div class="row">
<?php
echo $form->labelEx($model, 'client_id');
?>
<?php
echo $form->dropDownList($model, 'client_id', CHtml::listData(Clients::model()->findAll(), 'id', 'name'));
?>
</div>
<div class="row">
<?php
echo $form->labelEx($model, 'status');
?>
<?php
echo $form->dropDownList($model, 'status', Orders::model()->itemAlias('status'));
?>
</div>
<div class="row">
<?php
echo $form->labelEx($model, 'date');
示例12: getisClient
/**
* Return a value indicating whether the user is or not client
* By default user_id as unique param
* @return boolean value indicating wheter is or not client
*/
public function getisClient()
{
$Users = Clients::model()->with("Users")->count(array('select' => 't.user_id', 'condition' => 'Users.user_id = :user_id', 'params' => array(':user_id' => Yii::app()->user->id)));
return (bool) $Users;
}
示例13: function
padding: 8px 11px;
text-align:left;
font-size: 11px;
color: #222;
line-height: 12px;'), 'value' => function ($data) {
return '<span class="square ' . $data->dealPriority->color . '">square</span>' . CHtml::submitButton($data->text, array("class" => "button_to_link", 'onClick' => 'ActionEdit(' . $data->id . ',"deal", "dealings_page")'));
}), array('name' => 'client_id', 'header' => 'Клиент', 'headerHtmlOptions' => array('class' => 'w56_5', 'style' => ' height: 12px;
border-right: 1px solid #d9d9d9;
border-bottom: 1px solid #d9d9d9;
padding: 8px 11px;
text-align:left;
font-size: 11px;
color: #222;
line-height: 12px;'), 'type' => 'raw', 'value' => function ($data) {
$role = UsersRoles::model()->find('user_id=' . Yii::app()->user->id)->itemname;
$client_info = Clients::model()->findByPk($data->client_id);
$responsible = Users::model()->findByPk($client_info->responsable_id);
if ($client_info->responsable_id == Yii::app()->user->id || $responsible->parent_id == Yii::app()->user->id || $role == 'admin') {
return CHtml::link($data->client->name, Yii::app()->createUrl("page/client_profile", array("id" => $data->client->id)));
} else {
return $data->client->name;
}
}), array('name' => 'paid', 'header' => 'Уплачено / Остаток', 'headerHtmlOptions' => array('class' => 'w57_5', 'style' => ' height: 12px;
border-right: 1px solid #d9d9d9;
border-bottom: 1px solid #d9d9d9;
padding: 8px 11px;
text-align:left;
font-size: 11px;
color: #222;
line-height: 12px;'), 'type' => 'raw', 'value' => function ($data) {
return round($data->paid) . ' / ' . round($data->balance);
示例14: actionDelete_user
public function actionDelete_user($id)
{
if ($user = Users::model()->findByPk($id)) {
$admin = new Users();
$admin_id = $admin->getAdminId();
$new_responsible = $user->parent_id != null ? $user->parent_id : $admin_id;
Clients::model()->updateAll(array('responsable_id' => $new_responsible, 'creator_id' => $new_responsible), 'responsable_id=' . $id);
Deals::model()->updateAll(array('responsable_id' => $new_responsible), 'responsable_id=' . $id);
Actions::model()->updateAll(array('responsable_id' => $new_responsible), 'responsable_id=' . $id);
$user->delete();
$this->redirect(array('user_info'));
}
}
示例15: array
<div class="row">
<?php
echo $form->label($model, 'name');
?>
<?php
echo $form->textField($model, 'name', array('size' => 60, 'maxlength' => 255));
?>
</div>
<div class="row">
<?php
echo $form->label($model, 'client_id');
?>
<?php
echo $form->dropDownList($model, 'client_id', CHtml::listData(Clients::model()->findAll(), 'id', 'name'), array('empty' => '(Все)'));
?>
</div>
<div class="row">
<?php
echo $form->label($model, 'status');
?>
<?php
echo $form->dropDownList($model, 'status', Orders::model()->itemAlias('fstatus'), array('empty' => '[Все]'));
?>
</div>
<div class="row">
<?php
echo $form->label($model, 'date');