当前位置: 首页>>代码示例>>PHP>>正文


PHP Link::model方法代码示例

本文整理汇总了PHP中Link::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Link::model方法的具体用法?PHP Link::model怎么用?PHP Link::model使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Link的用法示例。


在下文中一共展示了Link::model方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 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));
 }
开发者ID:jerrylsxu,项目名称:yiifcms,代码行数:33,代码来源:IndexAction.php

示例2: run

 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'));
 }
开发者ID:jerrylsxu,项目名称:yiifcms,代码行数:28,代码来源:BatchAction.php

示例3: storeHref

 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;
         }
     }
 }
开发者ID:HiLeo1610,项目名称:tumlumsach,代码行数:32,代码来源:CrawlProvider.php

示例4: actionSuccess

 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));
 }
开发者ID:zywh,项目名称:maplecity,代码行数:7,代码来源:EvaluateController.php

示例5: loadModel

 /**
  * 判断数据是否存在
  * 
  * 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;
 }
开发者ID:jerrylsxu,项目名称:yiifcms,代码行数:17,代码来源:LinkController.php

示例6: actionIndex

 /**
  * 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')));
 }
开发者ID:github-zjh,项目名称:task,代码行数:20,代码来源:SiteController.php

示例7: actionIndex

 /**
  * 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')));
 }
开发者ID:jzxyouok,项目名称:yiifcms,代码行数:51,代码来源:SiteController.php

示例8: run

 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();
     }
 }
开发者ID:HiLeo1610,项目名称:tumlumsach,代码行数:17,代码来源:CopyCommand.php

示例9: run

 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;
             }
         }
     }
 }
开发者ID:HiLeo1610,项目名称:tumlumsach,代码行数:46,代码来源:ParseCommand.php

示例10: parseContent

 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;
 }
开发者ID:HiLeo1610,项目名称:tumlumsach,代码行数:24,代码来源:Phunuonline.php

示例11: run

 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;
 }
开发者ID:HiLeo1610,项目名称:tumlumsach,代码行数:24,代码来源:FixLinksCommand.php

示例12: foreach

                    <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>
开发者ID:zywh,项目名称:maplecity,代码行数:31,代码来源:main_bak.php

示例13: 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 $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;
 }
开发者ID:Romandre90,项目名称:vectortraveler,代码行数:15,代码来源:LinkController.php

示例14: actionCompare

 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));
 }
开发者ID:zywh,项目名称:maplecity,代码行数:13,代码来源:TestController.php

示例15: ghant_linksdeleted

 /**
  * 
  * @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);
     }
 }
开发者ID:nunomorgado,项目名称:ghant,代码行数:15,代码来源:GhantController.php


注:本文中的Link::model方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。