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


PHP Tags::model方法代码示例

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


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

示例1: findAndAdd

 public static function findAndAdd($title, $classify, $logid)
 {
     $title = zmf::filterInput($title, 't', 1);
     if (!$title) {
         return false;
     }
     $info = Tags::model()->find('title=:title AND classify=:classify', array(':title' => $title, ':classify' => $classify));
     if (!$info) {
         if (Yii::app()->session['checkHasBadword'] == 'yes') {
             $status = Posts::STATUS_STAYCHECK;
         } else {
             $status = Posts::STATUS_PASSED;
         }
         unset(Yii::app()->session['checkHasBadword']);
         $_data = array('title' => $title, 'name' => tools::pinyin($title), 'classify' => $classify, 'status' => $status, 'cTime' => time(), 'length' => mb_strlen($title, 'GBK'));
         $modelB = new Tags();
         $modelB->attributes = $_data;
         if ($modelB->save()) {
             $tagid = $modelB->id;
         }
     } else {
         $tagid = $info['id'];
     }
     if ($tagid && $logid) {
         $_info = TagRelation::model()->find('tagid=:tagid AND logid=:logid AND classify=:classify', array(':tagid' => $tagid, ':logid' => $logid, ':classify' => $classify));
         if (!$_info) {
             $_tagre = array('tagid' => $tagid, 'logid' => $logid, 'classify' => $classify, 'cTime' => zmf::now());
             $modelC = new TagRelation();
             $modelC->attributes = $_tagre;
             $modelC->save();
         }
     }
     return $tagid;
 }
开发者ID:ph7pal,项目名称:wedding,代码行数:34,代码来源:Tags.php

示例2: actionTaglist

 /**
  * 获取 Taglist 标签列表内容
  */
 public function actionTaglist()
 {
     $Rolelist = Tags::model();
     $cri = new CDbCriteria();
     $total = $Rolelist->count($cri);
     $pager = new CPagination($total);
     $pager->pageSize = 10;
     $pager->applyLimit($cri);
     $Infolist = $Rolelist->findAll($cri);
     $this->render('tag_list', array('taglist' => $Infolist, 'Pagers' => $pager));
 }
开发者ID:xuyi5918,项目名称:ipensoft,代码行数:14,代码来源:MainController.php

示例3: beforeAction

 /**
  * Конструктор
  * @return bool
  */
 protected function beforeAction()
 {
     $this->layout = 'start_page';
     $this->topMenu = Mainmenu::getMenu('top', 'site');
     $this->middleMenu = Mainmenu::getMenu('middle', 'site');
     $this->listChat = Chat::getListChat();
     $this->randomArt = Articles::getRandomArticles(10);
     $this->tags = Tags::getMenu(Tags::model()->findAll());
     $settingChat = Settings::model()->findByAttributes(array('parameter' => Yii::app()->params['parameter']['chat']));
     $this->stateChat = null != $settingChat ? (int) $settingChat->value : 0;
     if (!Yii::app()->user->isGuest) {
         $this->_user = Users::model()->findByPk(Yii::app()->user->id);
     } else {
         $this->_loginModel = new LoginForm();
     }
     return true;
 }
开发者ID:vitalya-xxx,项目名称:vitacod.ru,代码行数:21,代码来源:BaseController.php

示例4: actionCreate

 public function actionCreate($id = '')
 {
     $this->checkPower('addTag');
     if ($id) {
         $model = Tags::model()->findByPk($id);
         if (!$model) {
             $this->message(0, '该标签不存在');
         }
     } else {
         $model = new Tags();
         $model->classify = 'posts';
     }
     if (isset($_POST['Tags'])) {
         $model->attributes = $_POST['Tags'];
         if ($model->save()) {
             $this->redirect(array('index'));
         }
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:ph7pal,项目名称:momo,代码行数:20,代码来源:TagsController.php

示例5: checkAndWriteTag

 /**
  * 检查传入的标签是否已存在,不存在则创建,并检查是否已存在对应关系,不存在则创建
  * @param type $id
  * @param type $crumb
  */
 public function checkAndWriteTag($id, $crumb, $tagid = 0)
 {
     if (!$tagid) {
         $_crumb = strip_tags(trim($crumb));
         $_taginfo = Tags::model()->find('title=:title', array(':title' => $_crumb));
         if (!$_taginfo) {
             $_tagdata = array('title' => $_crumb, 'name' => zmf::pinyin($_crumb), 'classify' => 'posts', 'cTime' => time(), 'status' => 1);
             $model_tag = new Tags();
             $model_tag->attributes = $_tagdata;
             $_tagid = $model_tag->save(false);
         } else {
             $_tagid = $_taginfo['id'];
         }
     } else {
         $_tagid = $tagid;
     }
     $_tagrel = array('logid' => $id, 'tagid' => $_tagid, 'classify' => 'posts');
     $reinfo = TagRelation::model()->find('logid=:logid AND tagid=:tagid AND classify="posts"', array(':logid' => $id, ':tagid' => $_tagid));
     if (!$reinfo) {
         $model_tagrel = new TagRelation();
         $model_tagrel->attributes = $_tagrel;
         $model_tagrel->save(false);
     }
 }
开发者ID:ph7pal,项目名称:momo,代码行数:29,代码来源:TagRelation.php

示例6: save_product

 /**
  * Save a product in the database (Create if need be)
  *
  * @param string $passkey
  * @param int $intRowid
  * @param string $strCode
  * @param string $strName
  * @param string $blbImage
  * @param string $strClassName
  * @param int $blnCurrent
  * @param string $strDescription
  * @param string $strDescriptionShort
  * @param string $strFamily
  * @param int $blnGiftCard
  * @param int $blnInventoried
  * @param double $fltInventory
  * @param double $fltInventoryTotal
  * @param int $blnMasterModel
  * @param int $intMasterId
  * @param string $strProductColor
  * @param string $strProductSize
  * @param double $fltProductHeight
  * @param double $fltProductLength
  * @param double $fltProductWidth
  * @param double $fltProductWeight
  * @param int $intTaxStatusId
  * @param double $fltSell
  * @param double $fltSellTaxInclusive
  * @param double $fltSellWeb
  * @param string $strUpc
  * @param int $blnOnWeb
  * @param string $strWebKeyword1
  * @param string $strWebKeyword2
  * @param string $strWebKeyword3
  * @param int $blnFeatured
  * @param string $strCategoryPath
  * @return string
  */
 public function save_product($passkey, $intRowid, $strCode, $strName, $blbImage, $strClassName, $blnCurrent, $strDescription, $strDescriptionShort, $strFamily, $blnGiftCard, $blnInventoried, $fltInventory, $fltInventoryTotal, $blnMasterModel, $intMasterId, $strProductColor, $strProductSize, $fltProductHeight, $fltProductLength, $fltProductWidth, $fltProductWeight, $intTaxStatusId, $fltSell, $fltSellTaxInclusive, $fltSellWeb, $strUpc, $blnOnWeb, $strWebKeyword1, $strWebKeyword2, $strWebKeyword3, $blnFeatured, $strCategoryPath)
 {
     if (!$this->check_passkey($passkey)) {
         return self::FAIL_AUTH;
     }
     // We must preservice the Rowid of Products within the Web Store
     // database and must therefore see if it already exists
     $objProduct = Product::model()->findByPk($intRowid);
     if (!$objProduct) {
         $objProduct = new Product();
         $objProduct->id = $intRowid;
     }
     $strName = trim($strName);
     $strName = trim($strName, '-');
     $strName = substr($strName, 0, 255);
     $strCode = trim($strCode);
     $strCode = str_replace('"', '', $strCode);
     $strCode = str_replace("'", '', $strCode);
     if (empty($strName)) {
         $strName = 'missing-name';
     }
     if (empty($strDescription)) {
         $strDescription = '';
     }
     $objProduct->code = $strCode;
     $objProduct->title = $strName;
     //$objProduct->class_name = $strClassName;
     $objProduct->current = $blnCurrent;
     $objProduct->description_long = $strDescription;
     $objProduct->description_short = $strDescriptionShort;
     //$objProduct->family = $strFamily;
     $objProduct->gift_card = $blnGiftCard;
     $objProduct->inventoried = $blnInventoried;
     $objProduct->inventory = $fltInventory;
     $objProduct->inventory_total = $fltInventoryTotal;
     $objProduct->master_model = $blnMasterModel;
     if ($intMasterId > 0) {
         $objProduct->parent = $intMasterId;
     } else {
         $objProduct->parent = null;
     }
     $objProduct->product_color = $strProductColor;
     $objProduct->product_size = $strProductSize;
     $objProduct->product_height = $fltProductHeight;
     $objProduct->product_length = $fltProductLength;
     $objProduct->product_width = $fltProductWidth;
     $objProduct->product_weight = $fltProductWeight;
     $objProduct->tax_status_id = $intTaxStatusId;
     $objProduct->sell = $fltSell;
     $objProduct->sell_tax_inclusive = $fltSellTaxInclusive;
     //If we're in TaxIn Mode, then SellWeb has tax and we reverse it.
     if (_xls_get_conf('TAX_INCLUSIVE_PRICING', 0) == 1) {
         if ($fltSellWeb != 0) {
             //Tax in with a sell on web price
             $objProduct->sell_web_tax_inclusive = $fltSellWeb;
             //LS sends tax in web already
             $objProduct->sell_web = Tax::StripTaxesFromPrice($fltSellWeb, $intTaxStatusId);
         } else {
             //We use our regular prices and copy them price
             $objProduct->sell_web_tax_inclusive = $fltSellTaxInclusive;
             $objProduct->sell_web = $fltSell;
         }
//.........这里部分代码省略.........
开发者ID:uiDeveloper116,项目名称:webstore,代码行数:101,代码来源:LegacysoapController.php

示例7: actionDiscardNew

 /**
  * Called by the duplicate checker when discarding the new record.
  */
 public function actionDiscardNew()
 {
     if (isset($_POST['id'])) {
         $ref = $_POST['ref'];
         // Referring action
         $action = $_POST['action'];
         $oldId = $_POST['id'];
         if ($ref == 'create' && is_null($action) || $action == 'null') {
             echo CHtml::encode($oldId);
             return;
         } elseif ($ref == 'create') {
             $oldRecord = X2Model::model('Contacts')->findByPk($oldId);
             if (isset($oldRecord)) {
                 $oldRecord->disableBehavior('X2TimestampBehavior');
                 Relationships::model()->deleteAllByAttributes(array('firstType' => 'Contacts', 'firstId' => $oldRecord->id));
                 Relationships::model()->deleteAllByAttributes(array('secondType' => 'Contacts', 'secondId' => $oldRecord->id));
                 if ($action == 'hideThis') {
                     $oldRecord->dupeCheck = 1;
                     $oldRecord->assignedTo = 'Anyone';
                     $oldRecord->visibility = 0;
                     $oldRecord->doNotCall = 1;
                     $oldRecord->doNotEmail = 1;
                     $oldRecord->save();
                     $notif = new Notification();
                     $notif->user = 'admin';
                     $notif->createdBy = Yii::app()->user->getName();
                     $notif->createDate = time();
                     $notif->type = 'dup_discard';
                     $notif->modelType = 'Contacts';
                     $notif->modelId = $oldId;
                     $notif->save();
                     return;
                 } elseif ($action == 'deleteThis') {
                     $oldRecord->delete();
                     return;
                 }
             }
         } elseif (isset($_POST['newId'])) {
             $newId = $_POST['newId'];
             $oldRecord = X2Model::model('Contacts')->findByPk($oldId);
             $oldRecord->disableBehavior('X2TimestampBehavior');
             $newRecord = Contacts::model()->findByPk($newId);
             $newRecord->disableBehavior('X2TimestampBehavior');
             $newRecord->dupeCheck = 1;
             $newRecord->save();
             if ($action === '') {
                 $newRecord->delete();
                 echo CHtml::encode($oldId);
                 return;
             } else {
                 if (isset($oldRecord)) {
                     if ($action == 'hideThis') {
                         $oldRecord->dupeCheck = 1;
                         $oldRecord->assignedTo = 'Anyone';
                         $oldRecord->visibility = 0;
                         $oldRecord->doNotCall = 1;
                         $oldRecord->doNotEmail = 1;
                         $oldRecord->save();
                         $notif = new Notification();
                         $notif->user = 'admin';
                         $notif->createdBy = Yii::app()->user->getName();
                         $notif->createDate = time();
                         $notif->type = 'dup_discard';
                         $notif->modelType = 'Contacts';
                         $notif->modelId = $oldId;
                         $notif->save();
                     } elseif ($action == 'deleteThis') {
                         Relationships::model()->deleteAllByAttributes(array('firstType' => 'Contacts', 'firstId' => $oldRecord->id));
                         Relationships::model()->deleteAllByAttributes(array('secondType' => 'Contacts', 'secondId' => $oldRecord->id));
                         Tags::model()->deleteAllByAttributes(array('type' => 'Contacts', 'itemId' => $oldRecord->id));
                         Actions::model()->deleteAllByAttributes(array('associationType' => 'Contacts', 'associationId' => $oldRecord->id));
                         $oldRecord->delete();
                     }
                 }
                 echo CHtml::encode($newId);
             }
         }
     }
 }
开发者ID:shuvro35,项目名称:X2CRM,代码行数:82,代码来源:ContactsController.php

示例8: actionUpdate

 /**
  * Updates a particular model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id the ID of the model to be updated
  */
 public function actionUpdate($id)
 {
     $connection = Yii::app()->db;
     $transaction = $connection->beginTransaction();
     $model = $this->loadModel($id);
     $arrTags = $this->getAllTags();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Article'])) {
         $model->attributes = $_POST['Article'];
         $model->modifiedAt = date('Y-m-d');
         try {
             if ($model->save()) {
                 $articleId = $model->article_id;
                 Articletags::model()->deleteAll('article_id = ' . $id);
                 if ($_POST['Article']['tags'] != null) {
                     $postToLower = strtolower($_POST['Article']['tags']);
                     $arrPostTags = explode(',', $postToLower);
                     $arrDiffTags = array_diff($arrPostTags, $arrTags);
                     if (!empty($arrDiffTags)) {
                         foreach ($arrDiffTags as $arrDiffTag) {
                             $row[] = array('tag' => $arrDiffTag);
                         }
                         GeneralRepository::insertSeveral(Tags::model()->tableName(), $row);
                     }
                     $newArrTags = $this->getAllTags();
                     $newArrDiffTags = array_intersect($newArrTags, $arrPostTags);
                     foreach ($newArrDiffTags as $key => $newArrDiffTag) {
                         $newRow[] = array('article_id' => $articleId, 'tag_id' => $key);
                     }
                     GeneralRepository::insertSeveral(Articletags::model()->tableName(), $newRow);
                 }
                 $transaction->commit();
                 $this->redirect(array('view', 'id' => $model->article_id));
             }
         } catch (Exception $e) {
             $transaction->rollback();
             Yii::app()->user->setFlash('error', "{$e->getMessage()}");
             $this->refresh();
         }
     }
     $model['tags'] = $this->getArticleTags($id);
     $this->render('update', array('model' => $model, 'category_list' => $this->getAllCategories()));
 }
开发者ID:piond,项目名称:new_rsud,代码行数:49,代码来源:ArticleController.php

示例9: cleanUpTags

 /**
  * Delete all tags associated with a model
  */
 public function cleanUpTags($model)
 {
     Tags::model()->deleteAllByAttributes(array('itemId' => $model->id));
     /*$type=get_class($model);
     		if(substr($type,-1)!="s"){
     			$type=substr($type,0,-5)."s";
     		}
     		$change="";
     		if($model instanceof Contacts)
     			$change=$model->backgroundInfo;
     		else if($model instanceof Actions)
     			$change=$model->actionDescription;
     		else if($model instanceof Docs)
     			$change=$model->text;
     		else
     			$change=$model->description;
     		if($change!=""){
     			$forDeletion=$change;
     			preg_match_all('/(^|\s|)#(\w\w+)/',$forDeletion,$deleteMatches);
     			$deleteMatches=$deleteMatches[0];
     			foreach($deleteMatches as $match){
     				$oldTag=Tags::model()->findByAttributes(array('tag'=>$match,'type'=>$type,'itemId'=>$model->id));
     				if(isset($oldTag)) {
     					$oldTag->delete();
     				}
     			}
     		}*/
 }
开发者ID:netconstructor,项目名称:X2Engine,代码行数:31,代码来源:x2base.php

示例10: actionUpdate

 public function actionUpdate($id)
 {
     $model = $this->loadModel($id);
     $Category = new Category();
     $Tags = new Tags();
     $RewardImages = new RewardImages();
     if (isset($_POST['Reward']) && !empty($_POST['Reward'])) {
         //echo "<pre>";
         //print_r($_POST);
         //echo "<pre>";
         //print_r($_FILES);
         //die;
         $model->attributes = $_POST['Reward'];
         $model->category_id = $_POST['Reward']['category_id'];
         //echo "<pre>";
         //print_r($model->attributes);
         if ($model->save()) {
             //echo "----";
             $useridFolder = $model->id;
             if (isset($_POST['tags'])) {
                 $getTags = $_POST['tags'];
                 $mystring = $getTags;
                 $findme = ',';
                 $pos = strpos($mystring, $findme);
                 if ($pos === false) {
                     //echo "The string '$findme' was not found in the string '$mystring'";
                     //if that tag name already exist, skip that tag
                     $chkTagExist = Tags::model()->find('name = :name', array(':name' => $getTags));
                     if (empty($chkTagExist)) {
                         // echo "Tag not exist";
                         $insertMultiDoc = Yii::app()->db->createCommand()->insert('tags', array('reward_id' => $model->id, 'name' => $getTags));
                     } else {
                         //echo "dont save the Tag record";
                     }
                 } else {
                     //echo "The string '$findme' was found in the string '$mystring'";
                     //echo " and exists at position $pos";
                     //explode with comma
                     $getTagArray = explode(',', $getTags);
                     //insert into tags table with reward model id.
                     foreach ($getTagArray as $tagVal) {
                         //if that tag name already exist, skip that tag
                         $chkTagExist = Tags::model()->find('name = :name', array(':name' => $tagVal));
                         if (empty($chkTagExist)) {
                             // echo "Tag not exist";
                             $insertMultiDoc = Yii::app()->db->createCommand()->insert('tags', array('reward_id' => $model->id, 'name' => $tagVal));
                         } else {
                             //echo "dont save the Tag record";
                         }
                     }
                 }
             }
             //end tags
             $images = CUploadedFile::getInstancesByName('images');
             //echo "<pre>";
             //print_r($images);
             // proceed if the images have been set
             if (isset($images) && count($images) > 0) {
                 //upload multiple images, first create folder with reward id and store all related images in that folder.
                 // create folder
                 if ($_SERVER['DOCUMENT_ROOT'] == '/var/www/html') {
                     $setDir = $_SERVER['DOCUMENT_ROOT'] . "/images/reward/" . $useridFolder;
                 } else {
                     $setDir = $_SERVER['DOCUMENT_ROOT'] . "/jobstar/images/reward/" . $useridFolder;
                 }
                 if (is_dir($setDir) == false) {
                     mkdir("{$setDir}", 0777, true);
                     chmod("{$setDir}", 0777);
                 }
                 //end
                 //echo  $setDir;
                 //die;
                 // go through each uploaded image
                 $i = 0;
                 foreach ($images as $image => $pic) {
                     //echo "i am in images";
                     if ($i == '0') {
                         //first image will be default
                         $setDefaultStatus = '1';
                     } else {
                         $setDefaultStatus = '0';
                     }
                     //echo $pic->name.'<br />';
                     $finalName = $setDir . "/" . $pic->name;
                     //echo "<br>";
                     if ($pic->saveAs($finalName)) {
                         $chkImageExist = RewardImages::model()->find('image = :image', array(':image' => $pic->name));
                         if (empty($chkImageExist)) {
                             // echo "Image not exist";
                             // add it to the main model now
                             $insertMultiDoc = Yii::app()->db->createCommand()->insert('rewardimages', array('reward_id' => $model->id, 'image' => $pic->name, 'defaultImage' => $setDefaultStatus));
                         } else {
                             //echo "dont save the record";
                         }
                     } else {
                         //echo " handle the errors here, if you want";
                     }
                     $i++;
                 }
                 //end foreach
//.........这里部分代码省略.........
开发者ID:Gameonn,项目名称:JS_API,代码行数:101,代码来源:RewardController-old.php

示例11: array

	        <?php 
echo $form->listBox($model, 'classes', CHtml::listData(Classes::model()->findAll(array('order' => 'class_name')), 'class_name', 'class_name'), array('multiple' => 'multiple', 'class' => 'tall', 'onChange' => 'js:FillListValues(this)', 'onMouseDown' => 'js:GetCurrentListValues(this)'));
?>
	        <div class="clearfix"></div><?php 
echo CHtml::link(Yii::t('admin', 'Clear All'), '#', array('class' => 'listboxReset', 'onclick' => 'js:jQuery($("#' . CHtml::activeId($model, 'classes') . '").find("option").prop("selected", false))'));
?>
			<?php 
echo $form->error($model, 'classes');
?>
        </div>
        <div class="span2">
		    <?php 
echo $form->labelEx($model, 'keywords');
?>
		    <?php 
echo $form->listBox($model, 'keywords', CHtml::listData(Tags::model()->findAll(array('select' => 't.tag', 'order' => 'tag', 'distinct' => true)), 'tag', 'tag'), array('multiple' => 'multiple', 'class' => 'tall', 'onChange' => 'js:FillListValues(this)', 'onMouseDown' => 'js:GetCurrentListValues(this)'));
?>
	        <div class="clearfix"></div><?php 
echo CHtml::link(Yii::t('admin', 'Clear All'), '#', array('class' => 'listboxReset', 'onclick' => 'js:jQuery($("#' . CHtml::activeId($model, 'keywords') . '").find("option").prop("selected", false))'));
?>
		    <?php 
echo $form->error($model, 'keywords');
?>
        </div>
<!--        <div class="span2">-->
<!--		    --><?php 
//echo $form->labelEx($model,'codes');
?>
<!--		    --><?php 
//echo $form->listBox($model,'codes',
//		        CHtml::listData(Product::model()->findAllByAttributes(array('web'=>1),array('order'=>'code','limit'=>1000)), 'code', 'code'),
开发者ID:uiDeveloper116,项目名称:webstore,代码行数:31,代码来源:_restrictions.php

示例12: SetFeaturedByKeyword

 public static function SetFeaturedByKeyword($strKeyword)
 {
     Product::model()->updateAll(array('featured' => 0));
     Yii::app()->db->createCommand('update ' . Product::model()->tableName() . ' as a left join ' . ProductTags::model()->tableName() . ' as b on a.id=b.product_id left join ' . Tags::model()->tableName() . ' as c on b.tag_id=c.id set featured=1 where tag=:tag')->bindValue(':tag', $strKeyword)->execute();
 }
开发者ID:uiDeveloper116,项目名称:webstore,代码行数:5,代码来源:Product.php

示例13: actionVideo

 public function actionVideo($id)
 {
     if (!is_numeric($id)) {
         exit;
     }
     $this->ogtype = "yes";
     $this->videoID = $id;
     $ModalSeo = new CmsvideoSettings();
     $DataSeo = $ModalSeo->DownloadSettings();
     $ModelCategories = CmsvideoCategories::model()->findAll();
     $Model = CmsvideoVideo::model()->find('video_id=:IdVideo', array(':IdVideo' => $id));
     $criteria = new CDbCriteria(array('select' => 'video_id, video_title, video_thumb, video_views, video_alias', 'condition' => 'video_views >= 0 AND video_id != :IdVideo', 'order' => 'video_views DESC', 'params' => array(':IdVideo' => $id)));
     $total = CmsvideoVideo::model()->count();
     $pages = new CPagination($total);
     $pages->pageSize = 7;
     $pages->applyLimit($criteria);
     $VideoList = CmsvideoVideo::model()->findAll($criteria);
     $TagsId = unserialize($Model->video_tags);
     $ModelTags = array();
     if (is_array($TagsId) && !empty($TagsId)) {
         $TagsIdArr = join(',', $TagsId);
         $ModelTags = Tags::model()->findAllBySQL('SELECT tag_name FROM videocms_tags WHERE tag_id IN (' . $TagsIdArr . ')');
     }
     $session = Yii::app()->getSession();
     $video_arr = array();
     $ses_arr = array();
     if ($session['video_arr']) {
         $ses_arr = $session['video_arr'];
     }
     if (!in_array($id, $ses_arr)) {
         $video_arr = $ses_arr;
         $video_arr[] = $id;
         $Views = CmsvideoVideo::model()->find('video_id=:id', array(':id' => $id));
         if ($Views->video_views) {
             $Views->video_views = $Views->video_views + 1;
         } else {
             $Views->video_views = 1;
         }
         $Views->save();
         $session['video_arr'] = $video_arr;
     }
     foreach ($DataSeo as $Seoo) {
         $this->pageMetaRobots = $Seoo['settings_robots'];
         $this->disqus_shortname = $Seoo['disqus_shortname'];
         $this->player_autoplay = $Seoo['player_autoplay'];
         $this->player_preload = $Seoo['player_preload'];
         $this->player_loop = $Seoo['player_loop'];
         $this->player_controls = $Seoo['player_controls'];
     }
     // foreach ($Model as $Video)
     //  {
     $this->pageTitle = $Model->video_title;
     $this->pageMetaKeywords = $Model->video_keywords;
     $this->pageMetaDescription = $Model->video_description;
     $this->pageMetaOgImage = $Model->video_image;
     $this->pageAlias = $Model->video_alias;
     // $this->pageMetaDescription = $Video['video_description'];
     //}
     $this->render('video', array('ModelCategories' => $ModelCategories, 'ModelTags' => $ModelTags, 'Model' => $Model, 'VideoList' => $VideoList, 'pages' => $pages));
 }
开发者ID:videocms,项目名称:videocms-test,代码行数:60,代码来源:SiteController.php

示例14: array

<?php 
//$this->renderPartial('_search',array('model'=>$model,));
?>

</div>

<!-- search-form -->

<?php 
//echo CHtml::resetButton('Reset Search!', array('id'=>'form-reset-button'));
//echo CHtml::resetButton('Search', array('id'=>'form-search'));
?>

<?php 
$this->widget('zii.widgets.grid.CGridView', array('id' => 'reward-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array(array('name' => 'image', 'header' => 'Image', 'type' => 'html', 'value' => 'Reward::showImage($data->id)', 'filter' => false), 'title', array('name' => 'category_id', 'header' => 'Category', 'type' => 'html', 'value' => 'Reward::searchCat($data->category_id)', 'filter' => CHtml::listData(Category::model()->findAll(), 'id', 'name')), array('name' => 'tags', 'header' => 'Tags', 'type' => 'html', 'value' => 'Reward::searchTag($data->id)', 'filter' => CHtml::listData(Tags::model()->findAll(), 'id', 'name')), array('name' => 'Posted Date', 'type' => 'html', 'value' => '$data["createTime"]', 'filter' => false), array('name' => 'Status', 'type' => 'html', 'value' => array($this, 'getStatus'), 'filter' => false), array('class' => 'CButtonColumn', 'template' => '{update}{view}{delete}{status}'))));
?>


<script type="text/javascript">
/*<![CDATA[*/
function Show_Div(Div_id) {
            if (false == $(Div_id).is(':visible')) {
                $(Div_id).fadeIn();
            }
            else {
                $(Div_id).fadeOut();
            }
        }
jQuery(function($) {
开发者ID:Gameonn,项目名称:JS_API,代码行数:29,代码来源:admin-old.php

示例15: getDataProvider

 /**
  * Creates a {@link CActiveDataProvider} object for search queries.
  *
  * @param string $modelClass Optional, class of {@link CActiveRecord}. If
  *  unspecified, the class of {@link staticModel} will be used.
  * @param CDbCriteria $extraCriteria Criteria to merge with the automatically
  *  created criteria.
  * @param string $combineOp How to combine the custom/extra criteria
  */
 public function getDataProvider($modelClass = null, $extraCriteria = null, $combineOp = 'AND')
 {
     // Check for model
     $class = $modelClass == null && isset($_GET['_class']) ? get_class($this->staticModel) : $modelClass;
     if (empty($class) || !class_exists($class)) {
         $this->send(500, 'Method getDataProvider called without specifying ' . 'a valid model class, in action "' . $this->action->id . '".');
     }
     $staticModel = CActiveRecord::model($class);
     $model = new $class('search');
     // Compose attributes in the query parameters for the comparison:
     $searchAttributes = array_intersect_key($_GET, $staticModel->attributes);
     // Get search option parameters
     $optionParams = array_fill_keys($this->reservedParams['search'], 0);
     $searchOptions = array_intersect_key($_GET, $optionParams);
     // Configure the CDbCriteria object
     $criteria = new CDbCriteria();
     $criteria->alias = 't';
     if ($model instanceof X2Model) {
         // Special handling of X2Model subclasses:
         if ($model->asa('permissions') && $model->asa('permissions')->enabled) {
             // Working with an X2Model instance having its permissions behavior
             // enabled. Include access/permissions criteria.
             $criteria->mergeWith($model->getAccessCriteria());
         }
         if (isset($searchOptions['_tags'])) {
             // Add tag search criteria
             $criteria->distinct = true;
             $tags = array_map(function ($t) {
                 return '#' . $t;
             }, explode(',', $_GET['_tags']));
             $tagTable = Tags::model()->tableName();
             if (empty($searchOptions['_tagOr']) || !(bool) (int) $searchOptions['_tagOr']) {
                 // Perform an "and" tag search (must have all tags)
                 $i_tag = 0;
                 $joins = array();
                 foreach ($tags as $tag) {
                     $tagParam = ":apiSearchTag{$i_tag}";
                     $classParam = ":apiTagItemClass{$i_tag}";
                     $joinAlias = "tag{$i_tag}";
                     $joins[] = "INNER JOIN `{$tagTable}` `{$joinAlias}` " . "ON `{$joinAlias}`.`type`= {$classParam} " . "AND `{$joinAlias}`.`itemId`=`{$criteria->alias}`.`id` " . "AND `{$joinAlias}`.`tag`={$tagParam}";
                     $criteria->params[$tagParam] = $tag;
                     $criteria->params[$classParam] = get_class($model);
                     $i_tag++;
                 }
                 $criteria->join .= implode(' ', $joins);
             } else {
                 // Perform an "or" tag search (could have any one of the
                 // tags in the list)
                 $tagParam = AuxLib::bindArray($tags, 'apiSearchTag');
                 $tagIn = AuxLib::arrToStrList(array_keys($tagParam));
                 $criteria->join .= "INNER JOIN `{$tagTable}` `tag`" . "ON `tag`.`type`=:apiTagItemClass " . "AND `tag`.`itemId`=`{$criteria->alias}`.`id` " . "AND `tag`.`tag` IN {$tagIn}";
                 $tagParam[":apiTagItemClass"] = get_class($model);
                 foreach ($tagParam as $param => $value) {
                     $criteria->params[$param] = $value;
                 }
             }
         }
         // Special "codes" in comparison values.
         //
         // Not intended for more advanced formulae parsing but for basic
         // stuff, i.e. dynamic points in time like "yesterday"
         $now = time();
         $yesterday = $now - 86400;
         $tomorrow = $now + 86400;
         $codes = array('date' => compact('now', 'yesterday', 'tomorrow'), 'dateTime' => compact('now', 'yesterday', 'tomorrow'));
         $fields = $model->getFields();
         foreach ($fields as $field) {
             if (isset($searchAttributes[$field->fieldName])) {
                 if (isset($codes[$field->type])) {
                     foreach ($codes[$field->type] as $name => $value) {
                         $searchAttributes[$field->fieldName] = preg_replace('/' . $name . '$/', $value, $searchAttributes[$field->fieldName]);
                     }
                 }
             }
         }
     }
     // Search options:
     //
     // Send with parameter _partial=1 to enable partial match in searches
     $partialMatch = isset($searchOptions['_partial']) ? (bool) (int) $searchOptions['_partial'] : false;
     // Send with parameter _or=1 to enable the "OR" operator in the search
     $operator = isset($searchOptions['_or']) && (bool) (int) $searchOptions['_or'] ? 'OR' : 'AND';
     // Send with parameter _escape=0 to enable searching with MySQL wildcards
     $escape = isset($searchOptions['_escape']) ? (bool) (int) $searchOptions['_escape'] : true;
     // If searching for Actions, perform additional stuff first:
     if ($class === 'Actions') {
         $this->kludgesForSearchingActions($searchAttributes, $criteria);
     }
     // Run comparisons:
     $searchCriteria = new CDbCriteria();
     foreach ($searchAttributes as $column => $value) {
//.........这里部分代码省略.........
开发者ID:tymiles003,项目名称:X2CRM,代码行数:101,代码来源:Api2Controller.php


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