本文整理汇总了PHP中Executor::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Executor::model方法的具体用法?PHP Executor::model怎么用?PHP Executor::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Executor
的用法示例。
在下文中一共展示了Executor::model方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildLeads
public function buildLeads()
{
$leads = array();
$keywords = Keyword::model()->findAll('deleted_at IS NULL AND status = \'' . Keyword::STATUS_CHECKED . '\'');
foreach ($keywords as $k) {
$domain = '';
$executorCriteria = new CDbCriteria();
$executorCriteria->addCondition('keyword_id = :keyword_id');
$executorCriteria->addCondition('status = :status');
$executorCriteria->params = array(':keyword_id' => $k->id, ':status' => Executor::STATUS_DONE);
$executorCriteria->order = 'id DESC';
$executor = Executor::model()->find($executorCriteria);
if ($executor) {
$site = Site::model()->findAll('executor_id = :executor_id', array(':executor_id' => $executor->id));
$domain .= $site[0]->domain;
} else {
$domain = 'This task has never been checked';
}
array_push($leads, array('id' => $k->id, 'keyword' => $k->name, 'domain' => strlen($domain) > 0 ? $domain : 'No results ' . $executor->id, 'search_engine' => $k->search_engine, 'updated' => $executor->deleted_at));
}
return new CArrayDataProvider($leads, array('sort' => array('attributes' => array('*')), 'pagination' => array('pageSize' => 50)));
}
示例2: getActiveSearchEngines
public static function getActiveSearchEngines()
{
$currentExecutors = Executor::model()->findAll('deleted_at IS NULL');
$activeSearchEngines = array();
foreach ($currentExecutors as $e) {
if (!$e->keyword_id) {
continue;
}
$searchEngnie = '';
if ($dotPos = strpos($e->keyword->search_engine, '.')) {
$searchEngnie = substr($e->keyword->search_engine, 0, $dotPos);
} else {
$searchEngnie = $e->keyword->search_engine;
}
if (!in_array($searchEngnie, $activeSearchEngines)) {
$activeSearchEngines[] = $searchEngnie;
}
}
return $activeSearchEngines;
}
示例3: array
<?php
/* @var $this SiteController */
$this->pageTitle = Yii::app()->name;
?>
<p>Tasks done: <?php
echo Executor::model()->count('status = \'' . Executor::STATUS_DONE . '\'');
?>
</p>
<p>Tasks in total: <?php
echo Executor::model()->count();
?>
</p>
<p>Pending keywords: <?php
echo Keyword::model()->count('status = \'' . Keyword::STATUS_PENDING . '\'');
?>
</p>
<h3>Active Executors</h3>
<div>
<?php
$this->widget('zii.widgets.grid.CGridView', array('id' => 'grvKeywords', 'dataProvider' => $executor->searchActive(), 'htmlOptions' => array(), 'columns' => array(array('name' => 'id', 'header' => 'ID', 'value' => function ($e) {
return $e->id;
}), array('name' => 'keyword_id', 'header' => 'Keyword', 'value' => function ($e) {
return String::build('{keyword_id}: {keyword}', array('keyword' => $e->keyword->name, 'keyword_id' => $e->keyword_id));
}), array('header' => 'Search Engine', 'value' => function ($e) {
return ucwords($e->keyword->search_engine);
}), array('name' => 'status', 'header' => 'Status', 'value' => function ($e) {
return ucwords($e->status);
示例4: actionTerminateExecutor
public function actionTerminateExecutor($executorId)
{
$executor = Executor::model()->findByPk($executorId);
$executor->stop();
$this->redirect(Yii::app()->createUrl('site/statistics'));
}