本文整理汇总了PHP中Source::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Source::model方法的具体用法?PHP Source::model怎么用?PHP Source::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Source
的用法示例。
在下文中一共展示了Source::model方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getSourceByDomain
static function getSourceByDomain($Domain)
{
$appHost = parse_url($Domain);
if (isset($appHost['host'])) {
$criteria = new CDbCriteria();
$criteria->addSearchCondition('Domains', $appHost['host']);
$source = Source::model()->find($criteria);
if ($source) {
return $source->ID;
}
} else {
echo new ReturnInfo(RET_SUC, array('code' => -1, 'msg' => 'App链接有误,请参考填写规则'));
Yii::app()->end();
}
}
示例2: sourcesValidatorRule
function sourcesValidatorRule($attribute)
{
$srcarr = json_decode($this->{$attribute});
if (!is_array($srcarr) || count($srcarr) < 1) {
$this->addError($attribute, 'Must have at least a source');
return false;
}
foreach ($srcarr as $src) {
if (Source::model()->findByPk($src) == null) {
$this->addError($attribute, 'Invalid source detected');
return false;
}
}
return true;
}
示例3: actionList
public function actionList()
{
$os = Yii::app()->request->getParam('os', '');
$order = Yii::app()->request->getParam('order', 'DownLoadNum');
$where = 'b.Status = 0';
if ($os) {
$where .= ' AND c.OS = "' . addslashes($os) . '"';
}
$list = Yii::app()->db->createCommand()->select('a.PushId, b.IconUrl, b.AppName, b.PusherId, d.Name as MainCategory, ifnull(b.FileSize, "") as FileSize, c.OS, b.ProcessDate, max(a.CommentNum) as CommentNum, max(a.DownLoadNum) as DownLoadNum')->from('app_push_list_detail a')->join('app_push_list b', 'a.PushId = b.Id')->join('source c', 'b.SourceId = c.ID')->join('category d', 'b.MainCategory = d.ID')->group('a.PushId')->where($where)->order($order . ' desc')->queryAll();
$models = Source::model()->findAll();
$aPuhser = array();
foreach ($models as $m) {
$aPuhser[$m->ID] = $m->ChnName;
}
$aPuhser[0] = '';
$new_list = array();
foreach ($list as $row) {
$row['ChnName'] = $aPuhser[intval($row['PusherId'])];
$new_list[] = $row;
}
echo new ReturnInfo(0, $new_list);
}
示例4: 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 = Source::model()->findByPk($id);
if ($model === null) {
throw new CHttpException(404, 'The requested page does not exist.');
}
return $model;
}
示例5: actionDetail
/**
*App详情页面
*/
public function actionDetail()
{
$id = Yii::app()->request->getParam('id');
if (!isset($id) || empty($id)) {
throw new THttpException('查看的App不存在');
}
if (!is_int($id)) {
$id = intval($id);
}
$link = AppPushList::model()->findByPk($id);
if (!$link instanceof AppPushList) {
throw new THttpException('查看的App信息不存在');
}
$aInfo = array();
//app_push_list表的基本信息
$aInfo['Id'] = $link->Id;
$aInfo['AppName'] = $link->AppName;
$aInfo['IconUrl'] = $link->IconUrl;
$aInfo['SourceId'] = $link->SourceId;
$aInfo['AppUrl'] = $link->AppUrl;
$aInfo['AppInfo'] = $link->AppInfo;
$aInfo['ProcessDate'] = $link->ProcessDate;
$aInfo['FileSize'] = $link->FileSize;
//App市场名称
$aInfo['ChnName'] = Source::model()->findByPk($aInfo['SourceId'])->ChnName;
if (empty($aInfo['ChnName'])) {
$aInfo['ChnName'] = '';
}
//App所属类型
$aInfo['CategoryName'] = Category::model()->findByPk($link->MainCategory)->Name;
if (empty($aInfo['CategoryName'])) {
$aInfo['CategoryName'] = '';
}
//信息的轮播图片(link_info表)
$aInfo['imgurl'] = array();
if (!empty($link->ScreenShoot)) {
foreach (explode(',', $link->ScreenShoot) as $imageUrl) {
$aImage = array();
$aImage['imgurl'] = $imageUrl;
$aInfo['imgurl'][] = $aImage;
}
}
//App的下载总量/评论总量
$modal_detail = AppPushListDetail::model()->findAll(array('select' => array('Id', 'AppId', 'ApkName', 'MAX(DownLoadNum) as DownLoadNum', 'MAX(CommentNum) as CommentNum', 'PushId'), 'condition' => 'PushId = :Id', 'params' => array(':Id' => $id)));
foreach ($modal_detail as $num) {
$aInfo['DownLoadNum'] = $num->DownLoadNum;
$aInfo['CommentNum'] = $num->CommentNum;
}
//App评论内容
$aReply = array();
$modal_reply = AppPushListReviews::model()->findAll(array('select' => array('Id', 'PushId', 'Title', 'Content', 'UpdateTime', 'Status'), 'condition' => 'PushId = :Id', 'order' => 'UpdateTime desc', 'params' => array(':Id' => $id)));
if (!empty($modal_reply)) {
foreach ($modal_reply as $reply) {
$aReply[] = array('Id' => $reply->Id, 'PushId' => $reply->PushId, 'Title' => $reply->Title, 'Content' => $reply->Content, 'UpdateTime' => $reply->UpdateTime, 'Status' => $reply->Status);
}
}
//App 下载量/评论量 分析
$models_date = AppPushListDetail::model()->findAll(array('select' => array('PushId', 'DownLoadNum', 'CommentNum', 'Date'), 'condition' => 'PushId = :Id', 'order' => 'Date', 'params' => array(':Id' => $id)));
$num = array();
foreach ($models_date as $row) {
$num['Date'][] = $row->Date;
$num['DownLoadNum'][] = intval($row->DownLoadNum);
$num['CommentNum'][] = intval($row->CommentNum);
}
if (!empty($num['Date'])) {
$Date_json = json_encode($num['Date']);
} else {
$Date_json = 0;
}
if (!empty($num['DownLoadNum'])) {
$DownLoadNum_json = json_encode($num['DownLoadNum']);
} else {
$DownLoadNum_json = 0;
}
if (!empty($num['CommentNum'])) {
$CommentNum_json = json_encode($num['CommentNum']);
} else {
$CommentNum_json = 0;
}
$this->render('detail', array('data' => $aInfo, 'Date_json' => $Date_json, 'DownLoadNum_json' => $DownLoadNum_json, 'CommentNum_json' => $CommentNum_json, 'aReply' => $aReply));
}
示例6: array
/* @var $form CActiveForm */
?>
<div class="wide form">
<?php
$form = $this->beginWidget('CActiveForm', array('action' => Yii::app()->createUrl($this->route), 'method' => 'get'));
?>
<div class="proper-lft">
<div class="txt-log"><?php
echo $form->labelEx($model, 'enquiry_source');
?>
</div>
<div class="txt-box"><?php
echo $form->dropDownList($model, 'enquiry_source', CHtml::listData(Source::model()->findAll(), 's_tite', 's_tite'), array('empty' => '--Select Source--'));
?>
<?php
//echo $form->error($model,'enquiry_source');
?>
</div>
</div>
<div class="proper-rgt">
<div class="txt-log"><?php
echo $form->labelEx($model, 'priority_source');
?>
</div>
<div class="txt-box"><?php
echo $form->dropDownList($model, 'priority_source', CHtml::listData(Priority::model()->findAll(), 'p_title', 'p_title'), array('empty' => '--Select Priority--'));
?>
示例7: actionGetSourceType
public function actionGetSourceType()
{
$result = [];
if (isset($_GET['parentType']) && $_GET['parentType']) {
$parentType = $_GET['parentType'];
$sources = Source::model()->getTypes($parentType);
foreach ($sources as $source) {
/** @var $source Source [ ] */
$result[$source->sou_id] = $source->sou_title;
}
}
echo json_encode($result);
}
示例8:
</div>
<?php
echo $form->endControlGroup();
?>
<?php
echo $form->beginControlGroup($model, 'cli_source');
?>
<label class="control-label" for="cli_source">Referrer</label>
<div class="controls">
<?php
if ($model->cli_source) {
echo $model->source->getTitle();
} else {
echo CHtml::dropDownList("Client[sourceParent]", "", CHtml::listData(Source::model()->getTypes(0), 'sou_id', 'sou_title'), ['id' => 'sourceParentType', 'empty' => '']);
echo $form->dropDownList($model, "cli_source", [], ['id' => 'sourceType']);
}
?>
</div>
<?php
echo $form->endControlGroup();
?>
<?php
echo $form->beginControlGroup($model, 'cli_neg');
?>
<label class="control-label" for="cli_neg">Assigned Negotiator</label>
<div class="controls">
<?php