本文整理汇总了PHP中Domain::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Domain::model方法的具体用法?PHP Domain::model怎么用?PHP Domain::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Domain
的用法示例。
在下文中一共展示了Domain::model方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveEmailAddress
/**
* @param string $emailAddress
* @return mixed if true integer otherwise null
*/
public static function saveEmailAddress($emailAddress)
{
$emailID = null;
$parseEmail = explode('@', strtolower(trim($emailAddress)));
if (count($parseEmail) == 2) {
$domain = Domain::model()->findByAttributes(array('name' => $parseEmail[1]));
if (!$domain) {
$domain = new Domain();
$domain->name = $parseEmail[1];
}
if ($domain->save()) {
$email = new Email();
$email->username = $parseEmail[0];
$email->domainID = $domain->ID;
if ($email->save()) {
$emailID = $email->ID;
} else {
if ($domain->isNewRecord) {
Domain::model()->deleteByPk($domain->ID);
}
}
}
}
return $emailID;
}
示例2: loadDomain
protected function loadDomain()
{
if (null !== ($model = Domain::model()->findByAttributes(array('name' => Yii::app()->request->serverName)))) {
Yii::app()->getParams()->mergeWith($model->attributes);
} else {
$model = new Domain();
Yii::app()->getParams()->mergeWith($model->attributes);
}
}
示例3: getModel
/**
* Получение модели домена
* @return Domain
* @throws CException
*/
public function getModel()
{
if ($this->_model === null) {
$this->_model = Domain::model()->findByPk($this->mainDomainId);
}
if ($this->_model === null) {
throw new CException('Домен с id = ' . $this->mainDomainId . ' не найден.');
}
return $this->_model;
}
示例4: loadModel
/**
* Load Banque model
* @param integer $id
* @return Banque
* @throws CHttpException
*/
protected function loadModel($id = null)
{
if (null === $id) {
$model = new Domain();
} else {
$model = Domain::model()->findByPk($id);
}
if ($model instanceof CModel) {
$model->titleField = 'name';
return $model;
}
throw new CHttpException(404, 'Item not found');
}
示例5: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate($domain)
{
$model = new Record();
$model->domain_id = $domain;
$domain = Domain::model()->findByPK($domain);
$model->domain = $domain;
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['Record'])) {
$model->attributes = $_POST['Record'];
if ($model->save()) {
Yii::app()->audit->log('Created record: ' . $model->id);
$this->redirect(array('domain/update', 'id' => $domain->id));
}
}
$userId = Yii::app()->user->getId();
$user = User::model()->findByPK($userId);
$this->render('create', array('model' => $model, 'user' => $user));
}
示例6: actionAdminView
public function actionAdminView($id)
{
$model = DomainSuggestion::model()->findByPk($id);
if (strcasecmp($model->status, "pending") == 0) {
if (isset($_POST['button1'])) {
$model->status = "Accepted";
$model->description = $_POST['DomainSuggestion']['description'];
$domainID = $_POST['DomainSuggestion']['Domain'];
$dom = Domain::model()->findByPk($domainID);
if (is_null($dom)) {
$dom = new Domain();
$dom->name = $model->name;
$dom->description = $model->description;
$dom->need = "Medium";
$dom->need_amount = 5;
$dom->validator = 5;
$dom->save();
} else {
$subDom = new Subdomain();
$subDom->need = "Medium";
$subDom->name = $model->name;
$subDom->description = $model->description;
$subDom->validator = 5;
$subDom->need_amount = 5;
$subDom->domain_id = $dom->id;
$subDom->save();
}
if ($model->save()) {
$this->redirect(array('view', 'id' => $model->suggestion_id));
}
}
if (isset($_POST['button2'])) {
$model->status = "Rejected";
if ($model->save()) {
$this->redirect(array('view', 'id' => $model->suggestion_id));
}
}
$this->render('adminView', array('model' => $model));
} else {
$this->actionView($id);
}
}
示例7: getStatus
public static function getStatus($status)
{
$domainStatus = Domain::model()->findAll('Type=:Type', array('Type' => 'student'));
foreach ($domainStatus as $domain) {
if ($domain->ID == $status) {
return $domain->Name;
}
}
}
示例8: foreach
if ($userdoms == null) {
?>
<?php
echo "No Assigned Domains";
} else {
?>
<table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered" id="#mytable" width="100%">
<thead>
<tr>
<th width="50%">Domain Name</th>
<th width="50%">Subdomain/Rating/Tier</th>
</tr>
</thead>
<?php
foreach ($userdoms as $userdom) {
$domain = Domain::model()->find("id=:id", array(":id" => $userdom->domain_id));
$userdom = UserDomain::model()->findAllBySql("SELECT subdomain_id,rate,tier_team FROM user_domain WHERE domain_id={$domain->id} AND user_id={$user->id}");
?>
<tbody>
<tr>
<td><?php
echo $domain->name;
?>
</td>
<td>
<?php
$res = '';
foreach ($userdom as $udom) {
if ($udom->subdomain_id != null) {
$subdm = Subdomain::model()->findBySql("select * from subdomain where id = {$udom->subdomain_id}");
示例9: array
?>
<?php
echo $form->errorSummary($domainUser);
?>
<?php
echo $form->hiddenField($domainUser, 'user_id', array('value' => $model->id));
?>
<div class="row">
<?php
echo $form->labelEx($domainUser, 'domain_id');
?>
<?php
$models = Domain::model()->findAllBySql('SELECT * FROM `domains` WHERE `domains`.`id` NOT IN (SELECT `domain_id` FROM `domain_user` WHERE `user_id` = ' . $model->id . ') ORDER BY `domains`.`name`');
echo $form->dropDownList($domainUser, 'domain_id', CHtml::listData($models, 'id', 'name'));
?>
<?php
echo $form->error($domainUser, 'domain_id');
?>
</div>
<div class="row buttons">
<?php
echo CHtml::submitButton(Yii::t('app', 'page.add'));
?>
</div>
<?php
$this->endWidget();
示例10: array
<p class="note">Fields with <span class="required">*</span> are required.</p>
<?php
echo $form->errorSummary($model);
?>
<div id = "container"; style="margin-top:10px; width: 1000px; border: 1px solid #C9E0ED; border-radius: 5px;">
<div class ="row"; style = "margin-left: 40px">
<?php
echo $form->labelEx($model, 'domain_id');
?>
<?php
echo $form->dropDownList($model, 'domain_id', CHtml::listData(Domain::model()->findAll(), 'id', 'name'));
?>
<?php
echo $form->error($model, 'domain_id');
?>
</div>
<div class="row" style = "margin-left: 40px">
<?php
echo $form->labelEx($model, 'subdomain_id');
?>
<?php
echo $form->dropDownList($model, 'subdomain_id', CHtml::listData(Subdomain::model()->findAll(), 'id', 'name'), array('prompt' => 'Select'));
?>
<?php
echo $form->error($model, 'subdomain_id');
示例11: escalateTicket
public static function escalateTicket($domain_id, $sub)
{
if ($sub) {
$userDomain = UserDomain::model()->findAllBySql("SELECT * FROM user_domain WHERE subdomain_id =:id", array(":id" => $domain_id));
$subdomain = Subdomain::model()->findByPk($domain_id);
$validator = $subdomain->validator;
} else {
$userDomain = UserDomain::model()->findAllBySql("SELECT * FROM user_domain WHERE domain_id =:id", array(":id" => $domain_id));
$domain = Domain::model()->findByPk($domain_id);
$validator = $domain->validator;
}
if ($userDomain != null && is_array($userDomain)) {
foreach ($userDomain as $auserDomain) {
/** @var UserDomain $auserDomain */
if ($auserDomain->tier_team == 2) {
if ($auserDomain->rate >= $validator) {
/*Query to the domain mentor to see how many tickets is allowed to be assigned */
$domainMentor = DomainMentor::model()->findAllBySql("SELECT * FROM domain_mentor WHERE user_id =:id", array(":id" => $auserDomain->user_id));
/** @var Ticket $count */
if (is_array($domainMentor)) {
foreach ($domainMentor as $adomainMentor) {
/** @var DomainMentor $adomainMentor */
$count = Ticket::model()->findBySql("SELECT COUNT(id) as `id` FROM ticket WHERE assign_user_id =:id", array(":id" => $adomainMentor->user_id));
if ($count->id < $adomainMentor->max_tickets) {
/*return the first available domain mentor on queue */
return $auserDomain->user_id;
}
}
}
}
}
}
}
return self::$admin;
/* Assign the ticket to the admin for reassign */
}
示例12: loadModel
/**
* Returns the data model based on the primary key given in the GET variable.
* If the data model is not found, an HTTP exception will be raised.
* @param integer the ID of the model to be loaded
*/
public function loadModel($id)
{
$model = Domain::model()->findByPk($id);
if ($model === null) {
throw new CHttpException(404, 'The requested page does not exist.');
}
return $model;
}
示例13: actionAdmin_Create_User
public function actionAdmin_Create_User()
{
$model = new User();
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
$error = '';
if (isset($_POST['User'])) {
/*if ($this->actionVerifyRegistrationOld() != "") {
$this->render('create', array('model'=>$model));
}*/
$model->attributes = $_POST['User'];
$model->pic_url = '/coplat/images/profileimages/default_pic.jpg';
$model->biography = "Tell us something about yourself...";
$model->activation_chain = $this->genRandomString(10);
$model->activated = 1;
$error = $this->verifyRegistrationOld();
if (!$model->isProMentor && !$model->isDomMentor && !$model->isPerMentor && !$model->isMentee) {
$error = "Please select at least one user role.";
}
if ($error == null) {
$model->save(false);
if ($model->isProMentor) {
$proMentor = new ProjectMentor();
$proMentor->user_id = $model->id;
$proMentor->max_hours = 0;
$proMentor->max_projects = 0;
$proMentor->save(false);
}
if ($model->isDomMentor) {
$domMentor = new DomainMentor();
$domMentor->user_id = $model->id;
$domMentor->max_tickets = 0;
$domMentor->save();
}
if ($model->isPerMentor) {
$perMentor = new PersonalMentor();
$perMentor->user_id = $model->id;
$perMentor->max_hours = 0;
$perMentor->max_mentees = 0;
$perMentor->save();
}
if ($model->isMentee()) {
$mentee = new Mentee();
$mentee->user_id = $model->id;
$mentee->personal_mentor_user_id = null;
$mentee->project_id = null;
$mentee->save();
}
}
}
if (isset($_POST['Roles'])) {
$proMentor = ProjectMentor::model()->getProMentor($_COOKIE['UserID']);
$perMentor = PersonalMentor::model()->getPerMentor($_COOKIE['UserID']);
$domMentor = DomainMentor::model()->getDomMentor($_COOKIE['UserID']);
$mentee = Mentee::model()->getMentee($_COOKIE['UserID']);
//$model->save(false);
$user = User::model()->findByPk($_COOKIE['UserID']);
if ($user->isProMentor == 1) {
//$proMentor = new ProjectMentor;
$proMentor->user_id = $user->id;
$proMentor->max_hours = $_POST['pjmhours'];
$all = Project::model()->findAll();
$proMentor->save();
$count = 0;
foreach ($all as $each) {
if (isset($_POST[$each->id . 'pjm'])) {
$p = Project::model()->findByPk($each->id);
$p->project_mentor_user_id = $_COOKIE['UserID'];
$p->save(false);
$count++;
}
}
$proMentor->max_projects = $count;
$proMentor->save();
}
if ($user->isDomMentor == 1) {
//UserDomain::model()->deleteAll("user_id = ".$user->id);
$domMentor->max_tickets = $_POST['dmmaxtickets'];
$domMentor->save();
$all = Domain::model()->findAll();
foreach ($all as $each) {
if (isset($_POST[$each->id])) {
$user_domain = new UserDomain();
$user_domain->user_id = $domMentor->user_id;
$user_domain->domain_id = $each->id;
$user_domain->active = 1;
$user_domain->save(false);
$allsubs = Subdomain::model()->findAllBySql("select * from subdomain where domain_id = {$each->id}");
if ($allsubs != null) {
foreach ($allsubs as $onesub) {
$temp = $onesub->id . 'ddmsub';
if (isset($_POST[$temp])) {
$user_domain = new UserDomain();
$user_domain->user_id = $domMentor->user_id;
$user_domain->domain_id = $each->id;
$user_domain->active = 1;
$rate = $each->id . '-' . $onesub->id . 'dmrate';
$tier = $each->id . '-' . $onesub->id . 'dmtier';
$user_domain->rate = $_POST[$rate];
$user_domain->tier_team = $_POST[$tier];
//.........这里部分代码省略.........
示例14: domainExists
public function domainExists($domain)
{
$d = Domain::model()->findAllBySql("SELECT name FROM domain WHERE name='{$domain}'");
return $d;
/*
for($i = 0; $i < count($d); $i++)
{
if(strcasecmp($domain, $d[$i]->name))
{
return true;
}
else
{
return false;
}
}*/
}
示例15: getTicketColumns
function getTicketColumns($model)
{
//get or initialize the current column order
$columnArrayOrder = getColumnArrayOrder();
//only if make a cache of the columns if needed
if (isset($_GET['sourceColumn']) && isset($_GET['destinationColumn'])) {
$source = $_GET['sourceColumn'];
$destination = $_GET['destinationColumn'];
$sourceIndex = $source[0];
$destIndex = $destination[0];
ReportUtils::moveColumnsByIndex($sourceIndex, $destIndex, $columnArrayOrder);
Yii::app()->session['TicketColumnOrder'] = $columnArrayOrder;
}
$columns = array();
for ($i = 0; $i < count($columnArrayOrder); $i++) {
switch ($columnArrayOrder[$i]) {
case TicketReportColumns::ticketID:
$columns[] = array('name' => 'ticketID', 'header' => 'Ticket #', 'filter' => CHtml::activeNumberField($model, 'ticketID'), 'headerHtmlOptions' => array('width' => '75'));
break;
case TicketReportColumns::creatorName:
$columns[] = array('name' => 'creatorName', 'header' => 'Creator Name', 'filter' => CHtml::activeTextField($model, 'creatorName'), 'headerHtmlOptions' => array('width' => '200'));
break;
case TicketReportColumns::creatorID:
$columns[] = array('name' => 'creatorID', 'header' => 'Creator ID', 'filter' => CHtml::activeNumberField($model, 'creatorID'), 'headerHtmlOptions' => array('width' => '75'));
break;
case TicketReportColumns::creatorDisabled:
$columns[] = array('name' => 'creatorDisabled', 'header' => 'Creator Disabled', 'value' => 'ReportUtils::getZeroOneToYesNo($data->creatorDisabled)', 'filter' => array('1' => 'Yes', '0' => 'No'), 'headerHtmlOptions' => array('width' => '80'));
break;
case TicketReportColumns::creatorEmail:
$columns[] = array('name' => 'creatorEmail', 'header' => 'Creator Email', 'filter' => CHtml::activeEmailField($model, 'creatorEmail'), 'headerHtmlOptions' => array('width' => '150'));
break;
case TicketReportColumns::ticketStatus:
$columns[] = array('name' => 'ticketStatus', 'header' => 'Ticket Status', 'filter' => array('Close' => 'Close', 'Pending' => 'Pending'), 'headerHtmlOptions' => array('width' => '105'));
break;
case TicketReportColumns::ticketCreatedDate:
$columns[] = array('name' => 'ticketCreatedDate', 'header' => 'Created Date', 'value' => 'ReportUtils::dateformat($data->ticketCreatedDate)', 'filter' => CHtml::activeDateField($model, 'ticketCreatedDate'), 'headerHtmlOptions' => array('width' => '160'));
break;
case TicketReportColumns::assignedUserName:
$columns[] = array('name' => 'assignedUserName', 'header' => 'Assigned To (Name)', 'filter' => CHtml::activeTextField($model, 'assignedUserName'), 'headerHtmlOptions' => array('width' => '150'));
break;
case TicketReportColumns::ticketAssignUserID:
$columns[] = array('name' => 'ticketAssignUserID', 'header' => 'Assigned To (Id)', 'filter' => CHtml::activeNumberField($model, 'ticketAssignUserID'), 'headerHtmlOptions' => array('width' => '100'));
break;
case TicketReportColumns::assignedUserDisabled:
$columns[] = array('name' => 'assignedUserDisabled', 'header' => 'Assigned To (Disabled)', 'value' => 'ReportUtils::getZeroOneToYesNo($data->assignedUserDisabled)', 'filter' => array('1' => 'Yes', '0' => 'No'), 'headerHtmlOptions' => array('width' => '100'));
break;
case TicketReportColumns::assignedUserEmail:
$columns[] = array('name' => 'assignedUserEmail', 'header' => 'Assigned To (Email)', 'filter' => CHtml::activeEmailField($model, 'assignedUserEmail'), 'headerHtmlOptions' => array('width' => '150'));
break;
case TicketReportColumns::ticketDomainName:
$columns[] = array('name' => 'ticketDomainName', 'header' => 'Ticket Domain', 'filter' => CHtml::activeDropDownList($model, 'ticketDomainID', CHtml::listData(Domain::model()->findAll(), 'id', 'name'), array('empty' => ' ')), 'headerHtmlOptions' => array('width' => '200'));
break;
case TicketReportColumns::ticketSubDomainName:
$columns[] = array('name' => 'ticketSubDomainName', 'header' => 'Ticket Sub Domain', 'filter' => CHtml::activeDropDownList($model, 'ticketSubDomainID', CHtml::listData(Subdomain::model()->findAll(), 'id', 'name'), array('empty' => ' ')), 'headerHtmlOptions' => array('width' => '170'));
break;
case TicketReportColumns::ticketPriorityDescription:
$columns[] = array('name' => 'ticketPriorityDescription', 'header' => 'Ticket Priority', 'filter' => CHtml::activeDropDownList($model, 'ticketPriorityID', CHtml::listData(Priority::model()->findAll(), 'id', 'description'), array('empty' => ' ')), 'headerHtmlOptions' => array('width' => '110'));
break;
case TicketReportColumns::ticketAssignedDate:
$columns[] = array('name' => 'ticketAssignedDate', 'header' => 'Ticket Assigned Date', 'value' => 'ReportUtils::dateformat($data->ticketAssignedDate)', 'filter' => CHtml::activeDateField($model, 'ticketAssignedDate'), 'headerHtmlOptions' => array('width' => '160'));
break;
case TicketReportColumns::ticketClosedDate:
$columns[] = array('name' => 'ticketClosedDate', 'header' => 'Ticket Closed Date', 'value' => 'ReportUtils::dateformat($data->ticketClosedDate)', 'filter' => CHtml::activeDateField($model, 'ticketClosedDate'), 'headerHtmlOptions' => array('width' => '160'));
break;
case TicketReportColumns::ticketIsEscalated:
$columns[] = array('name' => 'ticketIsEscalated', 'header' => 'Escalated', 'value' => 'ReportUtils::getZeroOneToYesNo($data->ticketIsEscalated)', 'filter' => array('1' => 'Yes', '0' => 'No'), 'headerHtmlOptions' => array('width' => '80'));
break;
case TicketReportColumns::ticketSubject:
$columns[] = array('name' => 'ticketSubject', 'header' => 'Subject', 'filter' => CHtml::activeTextField($model, 'ticketSubject'), 'headerHtmlOptions' => array('width' => '300'));
break;
case TicketReportColumns::ticketDescription:
$columns[] = array('name' => 'ticketDescription', 'header' => 'Description', 'filter' => CHtml::activeTextField($model, 'ticketDescription'), 'headerHtmlOptions' => array('width' => '400'));
break;
}
}
return $columns;
}