コード例 #1
0
ファイル: IndexAction.php プロジェクト: jerrylsxu/yiifcms
 public function run()
 {
     //SEO
     $this->controller->_seoTitle = $this->controller->_setting['seo_title'];
     $this->controller->_seoKeywords = $this->controller->_setting['seo_keywords'];
     $this->controller->_seoDescription = $this->controller->_setting['seo_description'];
     //头部banner
     $index_top_banner = Ad::model()->getAdOne(4);
     //中部banner
     $index_mid_banner = Ad::model()->getAdOne(3);
     //底部banner
     $index_bottom_banner = Ad::model()->getAdOne(5);
     //最新资讯
     $news_new = Post::model()->getList(array('limit' => 20));
     //热门资讯
     $news_hot = Post::model()->getList(array('order' => 't.view_count DESC, t.id DESC', 'limit' => 20));
     //最新图集
     $image_new = Image::model()->getList(array('limit' => 10));
     //热门图集
     $image_hot = Image::model()->getList(array('limit' => 10, 'order' => 'view_count DESC, t.id DESC'));
     //最新软件
     $soft_new = Soft::model()->getList(array('limit' => 20));
     //热门软件
     $soft_hot = Soft::model()->getList(array('limit' => 10, 'order' => 'down_count DESC, t.id DESC'));
     //最新视频
     $video_new = Video::model()->findAll("status=:status AND catalog_id = 13 ORDER BY id DESC Limit 20", array(':status' => 'Y'));
     //热门视频
     $video_hot = Video::model()->findAll("status=:status AND catalog_id = 13 ORDER BY view_count DESC, video_score DESC, id DESC Limit 20", array(':status' => 'Y'));
     //友情链接
     $link_logos = Link::model()->findAll("logo !='' AND status='Y'", array('order' => 'sortorder ASC, id DESC'));
     $link_texts = Link::model()->findAll("logo ='' AND status='Y'", array('order' => 'sortorder ASC, id DESC'));
     $this->controller->render('index', array('index_top_banner' => $index_top_banner, 'index_mid_banner' => $index_mid_banner, 'index_bottom_banner' => $index_bottom_banner, 'link_logos' => $link_logos, 'link_texts' => $link_texts, 'news_new' => $news_new, 'news_hot' => $news_hot, 'image_new' => $image_new, 'image_hot' => $image_hot, 'soft_new' => $soft_new, 'soft_hot' => $soft_hot, 'video_new' => $video_new, 'video_hot' => $video_hot));
 }
コード例 #2
0
ファイル: BatchAction.php プロジェクト: jerrylsxu/yiifcms
 public function run()
 {
     $ids = Yii::app()->request->getParam('id');
     $command = Yii::app()->request->getParam('command');
     empty($ids) && $this->controller->message('error', Yii::t('admin', 'No Select'));
     if (!is_array($ids)) {
         $ids = array($ids);
     }
     $criteria = new CDbCriteria();
     $criteria->addInCondition('id', $ids);
     switch ($command) {
         case 'delete':
             //删除
             Link::model()->deleteAll($criteria);
             break;
         case 'show':
             //显示
             Link::model()->updateAll(['status' => Link::STATUS_SHOW], $criteria);
             break;
         case 'hide':
             //隐藏
             Link::model()->updateAll(['status' => Link::STATUS_HIDE], $criteria);
             break;
         default:
             $this->controller->message('error', Yii::t('admin', 'Error Operation'));
     }
     $this->controller->message('success', Yii::t('admin', 'Batch Operate Success'));
 }
コード例 #3
0
 public function storeHref($href)
 {
     $model = Link::model()->find('href = ?', $href);
     $needToFetch = false;
     if ($model == null) {
         if ($model == null) {
             $model = new Link();
             $needToFetch = true;
         }
     } else {
         $content = $model->getHTMLContent();
         if (empty($content)) {
             $needToFetch = true;
         }
     }
     if ($needToFetch) {
         $content = file_get_contents($href);
         $model->href = $href;
         $model->provider = $this->_providerName;
         $model->type = $this->getType();
         $canonicalUrl = $this->getCanonicalUrl($content);
         if (!empty($canonicalUrl)) {
             $model->href = $canonicalUrl;
         }
         if ($model->validate()) {
             echo 'store URL : ' . $href . PHP_EOL;
             $model->save();
             $model->saveHTMLContent($content);
             return $model;
         }
     }
 }
コード例 #4
0
ファイル: EvaluateController.php プロジェクト: zywh/maplecity
 public function actionSuccess()
 {
     $this->layout = ' ';
     Yii::app()->clientScript->registerCssFile(Yii::app()->theme->baseUrl . '/css/success.css');
     $link_list = Link::model()->findAll();
     $this->render('success', array('link_list' => $link_list));
 }
コード例 #5
0
ファイル: LinkController.php プロジェクト: jerrylsxu/yiifcms
 /**
  * 判断数据是否存在
  * 
  * return \$this->model
  */
 public function loadModel()
 {
     if ($this->model === null) {
         if (isset($_GET['id'])) {
             $this->model = Link::model()->findbyPk($_GET['id']);
         }
         if ($this->model === null) {
             throw new CHttpException(404, Yii::t('common', 'The requested page does not exist.'));
         }
     }
     return $this->model;
 }
コード例 #6
0
ファイル: SiteController.php プロジェクト: github-zjh/task
 /**
  * This is the default 'index' action that is invoked
  * when an action is not explicitly requested by users.
  */
 public function actionIndex()
 {
     //首页banner幻灯片
     $banner = Ad::model()->findAll('position_id=:pid', array(':pid' => 1));
     //SEO
     $this->_seoTitle = $this->_setting['seo_title'];
     $this->_seoKeywords = $this->_setting['seo_keywords'];
     $this->_seoDescription = $this->_setting['seo_description'];
     //加载css,js
     Yii::app()->clientScript->registerCssFile($this->_stylePath . "/css/index.css");
     Yii::app()->clientScript->registerScriptFile($this->_static_public . "/js/jquery/jquery.js");
     //友情链接
     $link_logos = Link::model()->findAll("logo !='' AND status_is='Y'", array('order' => 'sortorder ASC, id DESC'));
     $link_texts = Link::model()->findAll("logo ='' or logo is null AND status_is='Y'", array('order' => 'sortorder ASC, id DESC'));
     $this->render('index', compact(array('link_logos', 'link_texts')));
 }
コード例 #7
0
ファイル: SiteController.php プロジェクト: jzxyouok/yiifcms
 /**
  * This is the default 'index' action that is invoked
  * when an action is not explicitly requested by users.
  */
 public function actionIndex()
 {
     //首页banner幻灯片
     $banner = Ad::model()->findAll('position_id=:pid', array(':pid' => 1));
     //SEO
     $this->_seoTitle = $this->_setting['seo_title'];
     $this->_seoKeywords = $this->_setting['seo_keywords'];
     $this->_seoDescription = $this->_setting['seo_description'];
     //加载css,js
     Yii::app()->clientScript->registerCssFile($this->_stylePath . "/css/index.css");
     Yii::app()->clientScript->registerScriptFile($this->_static_public . "/js/jquery/jquery.js");
     Yii::app()->clientScript->registerScriptFile($this->_static_public . "/js/jquery/jquery.easytabs.min.js");
     //头部banner
     $index_top_banner = Ad::model()->getAdOne(4);
     //中部banner
     $index_mid_banner = Ad::model()->getAdOne(3);
     //底部banner
     $index_bottom_banner = Ad::model()->getAdOne(5);
     //最新资讯
     Yii::app()->cache && ($news_new = Yii::app()->cache->get('news_new'));
     if ($news_new == false) {
         $news_new = Post::model()->getList(array('limit' => 20));
         Yii::app()->cache && Yii::app()->cache->set('news_new', $news_new);
     }
     //热门资讯
     Yii::app()->cache && ($news_hot = Yii::app()->cache->get('news_host'));
     if ($news_hot == false) {
         $news_hot = Post::model()->getList(array('order' => 't.view_count DESC, t.id DESC', 'limit' => 20));
         Yii::app()->cache && Yii::app()->cache->set('news_hot', $news_hot);
     }
     //最新图集
     $image_new = Image::model()->getList(array('limit' => 10));
     //热门图集
     $image_hot = Image::model()->getList(array('limit' => 10, 'order' => 'view_count DESC, t.id DESC'));
     //最新软件
     $soft_new = Soft::model()->getList(array('limit' => 20));
     //热门软件
     $soft_hot = Soft::model()->getList(array('limit' => 10, 'order' => 'down_count DESC, t.id DESC'));
     //最新视频
     //$video_new = Video::model()->findAll("status=:status AND catalog_id = 13 ORDER BY id DESC Limit 20", array(':status'=>'Y'));
     //热门视频
     //$video_hot = Video::model()->findAll("status=:status AND catalog_id = 13 ORDER BY view_count DESC, video_score DESC, id DESC Limit 20", array(':status'=>'Y'));
     //友情链接
     $link_logos = Link::model()->findAll("logo !='' AND status_is='Y'", array('order' => 'sortorder ASC, id DESC'));
     $link_texts = Link::model()->findAll("logo ='' or logo is null AND status_is='Y'", array('order' => 'sortorder ASC, id DESC'));
     $this->render('index', compact(array('index_top_banner', 'index_mid_banner', 'index_bottom_banner', 'link_logos', 'link_texts', 'news_new', 'news_hot', 'image_new', 'image_hot', 'soft_new', 'soft_hot', 'video_new', 'video_hot')));
 }
コード例 #8
0
ファイル: CopyCommand.php プロジェクト: HiLeo1610/tumlumsach
 public function run($args)
 {
     $criteria = new CDbCriteria();
     $criteria->limit = self::DEFAULT_COPIED_LINKS;
     $criteria->condition = 'iscopied = 0';
     $links = Link::model()->findAll($criteria);
     $dataPath = Yii::app()->params['data_path'];
     foreach ($links as $link) {
         echo 'COPY content for the link #' . $link->link_id . ' with URL ' . $link->href . PHP_EOL;
         $contentFile = $dataPath . $link->link_id . '.html';
         $handle = fopen($contentFile, 'w') or die('Cannot open file:  ' . $contentFile);
         fwrite($handle, $link->content);
         fclose($handle);
         $link->iscopied = 1;
         $link->save();
     }
 }
コード例 #9
0
ファイル: ParseCommand.php プロジェクト: HiLeo1610/tumlumsach
 public function run($args)
 {
     $receiver = $args[0];
     $isForceFix = false;
     if (isset($args[1]) && $args[1] == 'force-fix') {
         $isForceFix = true;
     }
     switch ($receiver) {
         case 'tiki.vn':
             $provider = new Tiki();
             break;
         case 'vnexpress.net':
             $provider = new Vnexpress();
             break;
         case 'phunuonline.com.vn':
             $provider = new Phunuonline();
             break;
     }
     $criteria = new CDbCriteria();
     $criteria->addCondition(array('provider = :provider', 'fetched = :fetched'));
     $criteria->params = array(':provider' => $provider->getProviderName(), ':fetched' => 0);
     $criteria->limit = self::DEFAULT_PARSE_LIMIT;
     foreach (Link::model()->findAll($criteria) as $model) {
         echo $model->href . PHP_EOL;
         $objClsName = CrawlProvider::getObjClassName($provider->getType());
         $obj = $objClsName::model()->find('link_id = ' . $model->link_id);
         if ($obj == null) {
             echo 'Parse Content : ' . $model->href . ' ';
             $arrContent = $provider->parseContent($model->href, $isForceFix);
             if ($arrContent != null && !empty($arrContent)) {
                 echo 'Parsed Ok' . PHP_EOL;
                 $newObj = CrawlProvider::createNewObject($provider->getType());
                 foreach ($arrContent as $key => $value) {
                     //$value = mb_convert_encoding($value, "UTF-8");
                     $newObj->{$key} = $value;
                 }
                 $newObj->link_id = $model->link_id;
                 $newObj->save();
                 $model->fetched = 1;
                 $model->save();
             } else {
                 echo PHP_EOL;
             }
         }
     }
 }
コード例 #10
0
ファイル: Phunuonline.php プロジェクト: HiLeo1610/tumlumsach
 public function parseContent($href, $isForceFix = false)
 {
     $model = Link::model()->find('href = :href AND type = :type', array('href' => $href, 'type' => $this->getType()));
     $content = $model->getHTMLContent();
     if ($model == NULL || empty($content)) {
         echo 'store href ' . $href . PHP_EOL;
         $model = $this->storeHref($href);
     }
     if (!empty($model) && !empty($content)) {
         $arrContent = $this->_parseHTMLToContent($content);
         if ($this->_isValidContent($arrContent)) {
             return $this->_normalizeContent($arrContent);
         } else {
             $content = file_get_contents($model->href);
             $model->saveHTMLContent($content);
             $arrContent = $this->_parseHTMLToContent($content);
             if ($this->_isValidContent($arrContent)) {
                 $model->saveHTMLContent($content);
                 return $this->_normalizeContent($arrContent);
             }
         }
     }
     return null;
 }
コード例 #11
0
 public function run($args)
 {
     $criteria = new CDbCriteria();
     $criteria->condition = 'isfixed = 0';
     $criteria->limit = 250;
     foreach (Link::model()->findAll($criteria) as $link) {
         $href = trim($link->href);
         echo 'Fetching the URL ' . $href . PHP_EOL;
         try {
             $content = @file_get_contents($href);
             $link->content = $content;
             $link->href = $href;
             /*$otherLink = Link::model()->findBySql("href LIKE $href% AND link_id != '$link->link_id'");
             		if (!empty($otherLink)) {
             			$otherLink->delete();
             		}*/
             $link->isfixed = 1;
             $link->save();
         } catch (Exception $e) {
             $link->delete();
         }
     }
     echo 'DONE' . PHP_EOL;
 }
コード例 #12
0
ファイル: main_bak.php プロジェクト: zywh/maplecity
                    <div class="tel">400-870-1029</div>
                    <div class="telwz">枫之都能为您做些什么?</div>
                    <div class="telwz_time">周一至周日9:00-21:00<br />法定节假日除外</div>
                </div>
                <div class="cl"></div>
            </div>
            <!-- 二维码结束 -->
            <!-- foot开始 -->
            <div class="foot">
                <div class="footup">
                    <div class="f_linkup">
                        友情链接
                    </div>
                    <div class="f_linkdown">
                        <?php 
    $link_list = Link::model()->findAll();
    foreach ($link_list as $obj) {
        ?>
                        <a href="<?php 
        echo $obj->url;
        ?>
"><?php 
        echo $obj->title;
        ?>
</a>
                        <?php 
    }
    ?>
                        <div class="cl"></div>
                    </div>
                </div>
コード例 #13
0
 /**
  * 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 $id the ID of the model to be loaded
  * @return Link the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Link::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
コード例 #14
0
ファイル: TestController.php プロジェクト: zywh/maplecity
 public function actionCompare()
 {
     $this->layout = ' ';
     Yii::app()->clientScript->registerCssFile(Yii::app()->theme->baseUrl . '/css/compare.css');
     $data = Yii::app()->request->getQuery('id');
     $ids = explode(',', $data);
     $criteria = new CDbCriteria();
     $criteria->addInCondition('id', $ids);
     $house_list = House::model()->findAll($criteria);
     $link_list = Link::model()->findAll();
     $matches = Match::model()->findAll();
     $this->render('compare', array('house_list' => $house_list, 'link_list' => $link_list, 'matches' => $matches));
 }
コード例 #15
0
ファイル: GhantController.php プロジェクト: nunomorgado/ghant
 /**
  * 
  * @param type $sid
  * @param type $data
  */
 protected function ghant_linksdeleted($sid, $data)
 {
     $id = isset($data['id']) ? $data['id'] : NULL;
     $model = Link::model()->findByPk($id);
     if (!is_null($model) && $model->delete()) {
         $this->xmlOutputSuccess('deleted', $sid, $model->getPrimaryKey());
     } else {
         $this->xmlOutputError('Error deleted link', $sid);
     }
 }
コード例 #16
0
ファイル: Tiki.php プロジェクト: HiLeo1610/tumlumsach
 public function parseContent($href, $isForceFix = false)
 {
     $model = Link::model()->find("href LIKE '" . $href . "'");
     $content = $model->getHTMLContent();
     if ($model == null || empty($content)) {
         echo 'store href ' . $href . PHP_EOL;
         $model = $this->storeHref($href);
     }
     if (!empty($model) && !empty($content)) {
         $arrContent = array();
         $dom = new DOMDocument();
         libxml_use_internal_errors(true);
         $content = mb_convert_encoding($content, 'HTML-ENTITIES', "UTF-8");
         $dom->loadHTML($content);
         libxml_use_internal_errors(false);
         $dom->encoding = 'UTF-8';
         $xpath = new DOMXPath($dom);
         foreach ($this->_arrXPath as $key => $value) {
             if (is_array($value)) {
                 foreach ($value as $val) {
                     $content = $xpath->query($val);
                     if ($content->length > 0) {
                         break;
                     }
                 }
             } else {
                 $content = $xpath->query($value);
             }
             if ($content->length > 0) {
                 if ($key == 'photo') {
                     foreach ($content as $node) {
                         $href = $node->getAttribute('href');
                         if (is_string($href) && !empty($href)) {
                             $arrContent[$key] = $node->getAttribute('href');
                         }
                     }
                 } elseif ($key == 'description') {
                     $html = '';
                     $node = $content->item(0);
                     $d = new DOMDocument("1.0", "UTF-8");
                     foreach ($node->childNodes as $child) {
                         $d->appendChild($d->importNode($child, true));
                     }
                     $html .= $d->saveXML();
                     $xmlStr = '<?xml version="1.0" encoding="UTF-8"?>';
                     $p = strpos($html, $xmlStr);
                     if ($p !== false) {
                         $html = substr($html, strlen($xmlStr));
                     }
                     $arrContent[$key] = trim($html);
                 } else {
                     $arrContent[$key] = $content->item(0)->nodeValue;
                 }
             }
         }
         if ($this->_isValidContent($arrContent)) {
             return $this->_normalizeContent($arrContent);
         }
         return null;
     }
 }
コード例 #17
0
ファイル: Link.php プロジェクト: rainsongsky/24beta
 public static function fetchModels()
 {
     $criteria = new CDbCriteria();
     $criteria->order = 'orderid asc, id asc';
     $models = Link::model()->findAll($criteria);
     return $models;
 }
コード例 #18
0
 public function actionSitemap()
 {
     $condition = new CDbCriteria();
     $condition->condition = "news_type_id =2 AND status = 1";
     $condition->order = "create_date desc,news_id desc";
     $condition->offset = 0;
     $condition->limit = 6;
     $student_news = News::model()->findAll($condition);
     $news_criteria = new CDbCriteria();
     $news_criteria->condition = "news_type_id =1 AND status = 1";
     $news_criteria->order = "create_date desc,news_id desc";
     $news_criteria->offset = 0;
     $news_criteria->limit = 3;
     $news = News::model()->findAll($news_criteria);
     $job_criteria = new CDbCriteria();
     $job_criteria->condition = "news_type_id =3 AND status = 1";
     $job_criteria->order = "create_date desc,news_id desc";
     $job_criteria->offset = 0;
     $job_criteria->limit = 6;
     $job_news = News::model()->findAll($job_criteria);
     $pr_criteria = new CDbCriteria();
     $pr_criteria->condition = "news_type_id =5 AND status = 1";
     $pr_criteria->order = "create_date desc,news_id desc";
     $pr_criteria->offset = 0;
     $pr_criteria->limit = 3;
     $newsInSide = News::model()->findAll($pr_criteria);
     $link_criteria = new CDbCriteria();
     $link_criteria->condition = "status = 1";
     $link_criteria->order = "sort_order";
     $links = Link::model()->findAll($link_criteria);
     $criteria = new CDbCriteria();
     $criteria->condition = "status = 1 AND doc_group ='download'";
     $criteria->order = "sort_order";
     $doc = DocumentType::model()->findAll($criteria);
     $criteria = new CDbCriteria();
     $criteria->condition = "status = 1";
     $criteria->order = "sort_order";
     $org = Organization::model()->findAll($criteria);
     $criteria = new CDbCriteria();
     $criteria->condition = "status = 1";
     $criteria->order = "sort_order";
     $report = ReportType::model()->findAll($criteria);
     $vdo_criteria = new CDbCriteria();
     $vdo_criteria->condition = "page_id = 3 AND status = 1";
     $vdo = Page::model()->find($vdo_criteria);
     //                 echo "<br> ===> ";
     //                 echo "<pre>";
     //                 print_r($vdo);
     //                 echo "</pre>";
     //                 exit;
     $this->render('sitemap', array('news' => $news, 'newsInSide' => $newsInSide, 'job' => $job_news, 'student_news' => $student_news, 'doc' => $doc, 'org' => $org, 'links' => $links, 'report' => $report, 'vdo' => $vdo));
 }
コード例 #19
0
 public function actionLinkManagement()
 {
     if (!isset($_GET['id'])) {
         $this->redirect("/user/view_profile");
     } else {
         $dataset = Dataset::model()->findByPk($_GET['id']);
         if (!$dataset) {
             $this->redirect("/user/view_profile");
         }
         if ($dataset->submitter_id != Yii::app()->user->id) {
             Yii::app()->user->setFlash('keyword', "You are not the owner of dataset");
             $this->redirect("/user/view_profile");
         }
         $links = Link::model()->findAllByAttributes(array('dataset_id' => $dataset->id), array('order' => 'id asc'));
         $link_database = Yii::app()->db->createCommand()->select("prefix")->from("prefix")->order("prefix asc")->group("prefix")->queryAll();
         $this->render('linkManagement', array('model' => $dataset, 'links' => $links, 'link_database' => $link_database));
     }
 }
コード例 #20
0
 public function actionDeleteLink()
 {
     if (isset($_POST['link_id'])) {
         $link = Link::model()->findByPk($_POST['link_id']);
         if ($link->delete()) {
             Util::returnJSON(array("success" => true));
         }
         Util::returnJSON(array("success" => false, "message" => Yii::t("app", "Delete Error.")));
     }
 }
コード例 #21
0
ファイル: _linkgrid.php プロジェクト: ruzuojun/shiqu
<?php

Yii::app()->clientScript->registerScript("", "\$('[rel=popover]').popover();", CClientScript::POS_READY);
/*
 * 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.
 */
$criteria = new CDbCriteria();
$criteria->order = "no";
$criteria->addCondition("status=1");
$criteria->limit = $limit;
$models = Link::model()->findAll($criteria);
if (empty($models)) {
    echo "暂无话题";
} else {
    foreach ($models as $key => $value) {
        ?>
 
        <?php 
        echo CHtml::Link('<span class="label">' . $value->name . '</span>', $value->url, array('rel' => 'popover', 'data-placement' => 'top', 'data-trigger' => 'hover', 'data-title' => $value->name, 'data-content' => $value->desc, 'target' => '_blank'));
        ?>
        <?php 
    }
}
コード例 #22
0
ファイル: MiniLink.php プロジェクト: youngsun45/miniyun
 /**
  * 检测输入的密码是否跟系统设置一致
  * @param $key
  * @param $password
  * @return bool
  */
 public function checkPassword($key, $password)
 {
     $link = Link::model()->find("share_key=:share_key", array("share_key" => $key));
     if (isset($link)) {
         if ($link['password'] === md5($password)) {
             return true;
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
コード例 #23
0
ファイル: view.php プロジェクト: anjanababu/Asset-Management
echo $model->name;
?>
</span>
<?php 
echo CHtml::link('<i class="icon-pencil"></i>', array('update', 'id' => $model->id), array('class' => 'btn-warning btn buttonDesign', 'title' => 'Edit'));
echo CHtml::link('<i class="icon-trash"></i>', '#', array('class' => 'btn-warning btn buttonDesign', 'title' => 'Delete', 'submit' => array('delete', 'id' => $model->id), 'confirm' => 'Are you sure you want to delete this item?'));
echo "<br/>";
?>
</h1>

<?php 
$this->widget('ext.DetailView4Col', array('htmlOptions' => array('class' => 'table table-striped table-condensed table-hover'), 'data' => $model, 'attributes' => array('id', 'name', 'category_id', array('name' => 'location.name', 'label' => 'Location'), array('name' => 'user.name', 'label' => 'Technical Incharge'), array('name' => 'status.status', 'label' => 'Status'), array('name' => 'manufacturer.name', 'label' => 'Manufacturer'), array('name' => 'printertype.name', 'label' => 'Printer Type'), array('name' => 'managementtype.name', 'label' => 'Management Type'), 'memory', 'initial_page_counter', 'current_counter_of_pages', 'serial_number', 'documentFileName', 'imageFileName', 'enable_financial', 'available_on_loan', 'link_to')));
?>

<?php 
$link = Link::model()->findByAttributes(array('commodity2_id' => $model->commodity_id));
echo "<table class='table table-bordered'>";
if (count($link) == 0) {
    echo "<tr style='background:#F7819F;color:white'><td>No Commodity Linked to {$model->name}</td></tr>";
} else {
    $commodity = Commodity::model()->findByAttributes(array('id' => $link['commodity1_id']));
    $commodityItems = $commodity['name']::model()->findAllByAttributes(array('link_to' => $model->id));
    if (count($commodityItems) != 0) {
        echo "<tr style='background:#F5A9A9;'><th colspan='4' style='text-align:center'>Linked " . $commodity['name'] . " Allocate History</th></tr>";
        foreach ($commodityItems as $c) {
            $cartridgeName = $c['name'];
            $fullallocates = Allocate::model()->findAll("commodity_id =:commodity_id AND cons_id=:cons_id", array('commodity_id' => 12, 'cons_id' => $c['id']));
            $allocates = Allocate::model()->findAll("commodity_id =:commodity_id AND cons_id=:cons_id AND given_by IS NOT NULL", array('commodity_id' => 12, 'cons_id' => $c['id']));
            $total = count($fullallocates);
            $allocated = count($allocates);
            echo "<tr style='background:#F6E3CE'><th colspan='4'>{$cartridgeName} <code>{$allocated} / {$total} allocated</code></th></tr>";
コード例 #24
0
ファイル: AdminLink.php プロジェクト: rainsongsky/24beta
 /**
  * Returns the static model of the specified AR class.
  * @return AdminLink the static model class
  */
 public static function model($className = __CLASS__)
 {
     return parent::model($className);
 }
コード例 #25
0
ファイル: DefaultController.php プロジェクト: ruzuojun/shiqu
 /**
  * 删除友情链接
  */
 public function actionDeletelink($id)
 {
     if (Yii::app()->user->name == "admin") {
         $modelLink = Link::model()->findByPk($id);
         $modelLink->delete();
     }
 }
コード例 #26
0
ファイル: Post.php プロジェクト: nucleartux/YiiCh
	protected function afterFind() {
		parent::afterFind();
		$this->links=Link::model()->findAllByAttributes(array('board'=>$this->board,'vid'=>$this->vid));
	}