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


PHP Lookup::model方法代码示例

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


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

示例1: actionEditBlog

 public function actionEditBlog($id)
 {
     $model = new Post();
     $rec = Post::model()->findByPk($id);
     $r = Lookup::model()->findAll(array('condition' => 'type=:t', 'params' => array(':t' => 'PostStatus')));
     //echo "<pre>";print_r($r);die;
     foreach ($r as $type) {
         //echo "<pre>";print_r($type);
         $i[] = $type->id;
         $n[] = $type->name;
         $op = array_combine($i, $n);
     }
     //die;
     //echo "<pre>";print_r($rec);die;
     if (isset($_POST['Post'])) {
         $model->attributes = $_POST['Post'];
         if ($model->validate()) {
             $res = Post::model()->findByPk($id);
             $res->title = $_REQUEST['Post']['title'];
             $res->content = $_REQUEST['Post']['content'];
             $res->tags = $_REQUEST['Post']['tags'];
             $res->status = $_REQUEST['Post']['status'];
             $res->update_time = date('Y-m-d');
             if ($res->save(false)) {
                 $this->redirect(array('postlisting'));
             }
         } else {
             $errors = $model->getErrors();
         }
     }
     $this->render('editblog', array('edit' => $rec, 'model' => $model, 'type' => $op, 'i' => $i));
 }
开发者ID:KaranSofat,项目名称:yii,代码行数:32,代码来源:PostController.php

示例2: actionSearch

 function actionSearch()
 {
     header('Content-type: application/json');
     //	   if(Yii::app()->user->isGuest){
     //			IjoyPlusServiceUtils::exportServiceError(Constants::SEESION_IS_EXPIRED);
     //			return ;
     //		}
     if (!IjoyPlusServiceUtils::validateAPPKey()) {
         IjoyPlusServiceUtils::exportServiceError(Constants::APP_KEY_INVALID);
         return;
     }
     $keyword = Yii::app()->request->getParam("keyword");
     if (!(isset($keyword) && !is_null($keyword) && strlen($keyword) > 0)) {
         IjoyPlusServiceUtils::exportServiceError(Constants::KEYWORD_IS_NULL);
         return;
     }
     $keyword = trim($keyword);
     Lookup::model()->saveLookup($keyword);
     if (!FilterUtils::keyWordValid($keyword)) {
         IjoyPlusServiceUtils::exportEntity(array('results' => array()));
         return;
     }
     //   		$keyword= iconv("GBK","UTF-8",$keyword);n
     //   		var_dump($keyword);
     //$keyword='???';
     //        var_dump($keyword);
     $keyword = strtr($keyword, array('%' => '\\%', '_' => '\\_'));
     //   		var_dump($keyword);
     $page_size = Yii::app()->request->getParam("page_size");
     $page_num = Yii::app()->request->getParam("page_num");
     if (!(isset($page_size) && is_numeric($page_size))) {
         $page_size = 10;
         $page_num = 1;
     } else {
         if (!(isset($page_num) && is_numeric($page_num))) {
             $page_num = 1;
         }
     }
     $type = Yii::app()->request->getParam("type");
     try {
         if (is_null($type) || $type == '') {
             $prods = SearchManager::searchProgram($keyword, $page_size, $page_size * ($page_num - 1));
         } else {
             $prods = SearchManager::searchProgramByType($keyword, $type, $page_size, $page_size * ($page_num - 1));
         }
         if (isset($prods) && is_array($prods)) {
             IjoyPlusServiceUtils::exportEntity(array('results' => $prods));
         } else {
             IjoyPlusServiceUtils::exportEntity(array('results' => array()));
         }
     } catch (Exception $e) {
         var_dump($e);
         IjoyPlusServiceUtils::exportServiceError(Constants::SYSTEM_ERROR);
     }
 }
开发者ID:andyongithub,项目名称:joyplus-cms,代码行数:55,代码来源:SearchController.php

示例3: actionAvatars

 public function actionAvatars()
 {
     $this->layout = '//layouts/blank';
     $dataProvider = null;
     if (isset($_GET['uid'])) {
         $id = $_GET['uid'];
         $type = $_GET['type'] ? $_GET['type'] : Lookup::USER_PIC_FOLDER;
         $lookup = Lookup::model()->find(array('condition' => 'uid = :uid AND type = :type', 'params' => array(':uid' => $id, ':type' => $type)));
         if ($lookup !== null) {
             $pid = $lookup->id;
             $criteria = new CDbCriteria(array('condition' => 'pid = :pid AND uid = :uid', 'order' => 'id DESC', 'params' => array(':pid' => $pid, ':uid' => $id)));
             $count = File::model()->count($criteria);
             $pages = new CPagination($count);
             // results per page
             $pages->pageSize = 14;
             $pages->applyLimit($criteria);
             $dataProvider = new CActiveDataProvider('File', array('criteria' => $criteria, 'pagination' => $pages));
         }
     }
     $this->render('avatars', array('dataProvider' => $dataProvider));
 }
开发者ID:yunsite,项目名称:my-advertise,代码行数:21,代码来源:FileController.php

示例4: actionAdmin

	/**
	 * Manages all models.
	 */
	public function actionAdmin()
	{
		$all = Lookup::model()->getAll();
		Y::dump($all);
		$model = new Portfolio('search');
		$model->unsetAttributes();  // clear any default values
		$model = $model->current($cat);
		
		if (isset($_GET['Portfolio']))
			$model->attributes=$_GET['Portfolio'];
		
		if (isset($_GET['ajax'])) {
			$this->renderPartial('admingrid',array(
	            'model'=>$model,
		    ));
    	} else {
    		$this->render('admin',array(
				'model'=>$model,
    			'cat'=>$cat
    		));
		}
	}
开发者ID:nizsheanez,项目名称:PolymorphCMS,代码行数:25,代码来源:SettingsController.php

示例5: 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.
  */
 public function loadModel()
 {
     if ($this->_model === null) {
         if (isset($_GET['id'])) {
             $this->_model = Lookup::model()->findbyPk($_GET['id']);
         }
         if ($this->_model === null) {
             throw new CHttpException(404);
         }
     }
     return $this->_model;
 }
开发者ID:amlap,项目名称:Yii-Extensions,代码行数:16,代码来源:DefaultController.php

示例6: actionGetRemoteImage

 public function actionGetRemoteImage()
 {
     $url = isset($_POST['url']) ? $_POST['url'] : die('图片地址不正确~');
     $info = UtilHelper::resourceLocalize($url);
     //        UtilHelper::dump($info);
     $model = new File();
     $model->name = $info['filename'];
     $model->ext = $info['extension'];
     $model->created = time();
     $model->size = $info['size'];
     $model->pid = Lookup::model()->getUserAdThemeAlbum(Yii::app()->user->id)->id;
     $model->mime = File::model()->getMimeType($model->ext, $info['mime']);
     $src = './public/favorite/' . $model->name . '.' . $model->ext;
     $target = File::model()->generateFileName($model, 'adtheme', true);
     //        UtilHelper::dump($model->attributes);
     if ($model->save()) {
         UtilFile::moveFile($src, $target);
         $result = array('id' => $model->id, 'path' => File::model()->generateFileName($model, 'adtheme', false));
         echo json_encode($result);
     }
 }
开发者ID:yunsite,项目名称:my-advertise,代码行数:21,代码来源:ThemeController.php

示例7: getUserAlbum

 /**
  * 获取用户图片上传目录信息
  */
 private function getUserAlbum($userID, $name, $type)
 {
     $model = Lookup::model()->find(array('condition' => 'uid = :uid AND type = :type', 'params' => array(':uid' => $userID, ':type' => $type)));
     if ($model == null) {
         $model = new Lookup();
         $model->type = $type;
         $model->name = $name;
         $model->ename = Yii::app()->user->name . '_' . ucfirst(UtilHelper::words2PinYin($name)) . 'Album';
         $model->weight = 1;
         $model->description = $name . '相关图册';
         $model->save();
     }
     return $model;
 }
开发者ID:yunsite,项目名称:my-advertise,代码行数:17,代码来源:Lookup.php

示例8: array

echo $form->labelEx($model, 'ename');
?>
		<?php 
echo $form->textField($model, 'ename', array('size' => 30, 'maxlength' => 30, 'class' => 'span-5 poshy', 'title' => '项目名称别名,由字母a-z组成'));
?>
		<?php 
echo $form->error($model, 'ename', array('class' => 'clear', 'style' => 'color:red;'));
?>
	</div>
	
	<div class="row span-5">
		<?php 
echo $form->labelEx($model, 'type');
?>
		<?php 
echo $form->dropDownList($model, 'type', Lookup::model()->generateLookUpItemList(), array('class' => 'span-5 poshy', 'title' => '项目分类'));
?>
		<?php 
echo $form->error($model, 'type');
?>
	</div>
	
	<div class="row span-11">
		<?php 
echo $form->labelEx($model, 'weight');
?>
		<?php 
echo $form->dropDownList($model, 'weight', array_combine(range(1, 20), range(1, 20)), array('class' => 'span-11 poshy', 'title' => '项目权重'));
?>
		<?php 
echo $form->error($model, 'weight');
开发者ID:yunsite,项目名称:my-advertise,代码行数:31,代码来源:_form.php

示例9: 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 Lookup the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Lookup::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
开发者ID:hongha,项目名称:traodoidocu,代码行数:15,代码来源:LookupController.php

示例10: array

<?php

$this->widget('ext.uploadify.uploadifyWidget', array('script' => $this->createUrl('/archiver/upload'), 'checkScript' => $this->createUrl('/archiver/checkupload'), 'onComplete' => 'js:function(event, ID, fileObj, response, data){updateImage(response);}', 'fileExt' => '*.jpg;*.gif;*.jpeg;*.png;', 'pid' => Lookup::model()->getUserDefaultAlbum(Yii::app()->user->id)->id, 'auto' => true));
开发者ID:yunsite,项目名称:my-advertise,代码行数:3,代码来源:uploadavatar.php

示例11: loadAvatars

					
				uu.alertInfo('头像已更改');	

			});		
			
			return ;
		}
		
		uu.alertInfo('请选择一个剪切区域,然后点击“更换头像”按钮.');
		return false;
	};
    
    function loadAvatars()
    {
        $("#loadAvatars").load('<?php 
echo $this->createUrl('/file/avatars', array('uid' => Yii::app()->user->id, 'pid' => Lookup::model()->getUserAdThemeAlbum(Yii::app()->user->id)->id, 'type' => Lookup::USER_ADTHEME_PIC_FOLDER));
?>
');
       
    }
    
    
    
    //加载上传控件
    function loadUpload()
	{
		$('#loadUpload').load('<?php 
echo $this->createUrl("/theme/uploadimage");
?>
');
	}
开发者ID:yunsite,项目名称:my-advertise,代码行数:30,代码来源:getscreenshot.php

示例12: array

<?php

$this->pageTitle = Yii::app()->name . ' - ' . Yii::t('LookupModule.ui', 'Lookup Names');
$this->breadcrumbs = array(Yii::t('LookupModule.ui', 'Lookup Names'));
?>

<h2><?php 
echo Yii::t('LookupModule.ui', 'Lookup Names');
?>
</h2>

<?php 
$this->widget('zii.widgets.CMenu', array('items' => Lookup::model()->menu, 'htmlOptions' => array('style' => 'line-height:200%')));
开发者ID:hanra,项目名称:Yii-Playground,代码行数:13,代码来源:index.php

示例13: actionToDoTest

 public function actionToDoTest()
 {
     //上传配置
     $config = array("uploadPath" => Yii::app()->params['uploadPath']['advertisement'], "fileType" => array(".gif", ".png", ".jpg", ".jpeg", ".bmp"), "fileSize" => 1000);
     //文件上传状态,当成功时返回SUCCESS,其余值将直接返回对应字符窜并显示在图片预览框,同时可以在前端页面通过回调函数获取对应字符窜
     $state = "SUCCESS";
     $title = htmlspecialchars($_POST['pictitle'], ENT_QUOTES);
     $path = $config['uploadPath'];
     if (!file_exists($path)) {
         mkdir("{$path}", 0777);
     }
     //格式验证
     $current_type = strtolower(strrchr($_FILES["picdata"]["name"], '.'));
     if (!in_array($current_type, $config['fileType'])) {
         $state = "不支持的图片类型!";
     }
     //大小验证
     $file_size = 1024 * $config['fileSize'];
     if ($_FILES["picdata"]["size"] > $file_size) {
         $state = "图片大小超出限制!";
     }
     //保存图片
     if ($state == "SUCCESS") {
         $tmp_file = $_FILES["picdata"]["name"];
         $file = $path . rand(1, 10000) . time() . strrchr($tmp_file, '.');
         $info = pathinfo($_FILES['picdata']['name']);
         $model = new File();
         $model->pid = Lookup::model()->getUserAdvertisementAlbum(Yii::app()->user->id)->id;
         $model->size = $_FILES['picdata']['size'];
         $model->ext = strtolower($info['extension']);
         $model->name = $info['filename'];
         $model->created = time();
         $model->mime = File::model()->getMimeType($model->ext, $_FILES['picdata']['type']);
         UtilHelper::writeToFile($_FILES, './public/testd.txt', 'w+');
         UtilHelper::writeToFile(pathinfo($_FILES['picdata']['name']), './public/testd.txt', 'a+');
         UtilHelper::writeToFile($model->attributes);
         $file = File::model()->generateFileName($model, 'advertisement', true);
         UtilHelper::writeToFile($file, './public/testd.txt', 'a+');
         if ($model->save()) {
             $result = move_uploaded_file($_FILES["picdata"]["tmp_name"], $file);
             if (!$result) {
                 $state = "图片保存失败!";
             }
         } else {
             $state = "数据保存失败!";
         }
     }
     //向浏览器返回数据json数据
     $file = str_replace(array('../', './'), '', $file);
     //为方便理解,替换掉所有类似../和./等相对路径标识
     $str = "{'url':'" . $file . "','title':'" . $title . "','state':'" . $state . "'}";
     echo $str;
 }
开发者ID:yunsite,项目名称:my-advertise,代码行数:53,代码来源:ArchiverController.php

示例14: ucfirst

 * @author Brett O'Donnell <cornernote@gmail.com>
 * @author Zain Ul abidin <zainengineer@gmail.com>
 * @copyright 2013 Mr PHP
 * @link https://github.com/cornernote/yii-dressing
 * @license BSD-3-Clause https://raw.github.com/cornernote/yii-dressing/master/license.txt
 */
$this->pageTitle = $this->getName() . ' ' . Yii::t('dressing', ucfirst($task));
$lookup = $id ? Lookup::model()->findByPk($id) : new Lookup('search');
/** @var YdActiveForm $form */
$form = $this->beginWidget('dressing.widgets.YdActiveForm', array('id' => 'lookup-' . $task . '-form', 'type' => 'horizontal', 'action' => array('/lookup/delete', 'id' => $id, 'task' => $task, 'confirm' => 1)));
echo $this->getGridIdHiddenFields($id);
echo $form->beginModalWrap();
echo $form->errorSummary($lookup);
echo '<fieldset>';
echo '<legend>' . Yii::t('dressing', 'Selected Records') . '</legend>';
$lookups = Lookup::model()->findAll('t.id IN (' . implode(',', YdHelper::getGridIds($id)) . ')');
if ($lookups) {
    echo '<ul>';
    foreach ($lookups as $lookup) {
        echo '<li>';
        echo $lookup->getName();
        echo '</li>';
    }
    echo '</ul>';
}
echo '</fieldset>';
echo $form->endModalWrap();
echo '<div class="' . $form->getSubmitRowClass() . '">';
$this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'submit', 'type' => 'primary', 'label' => Yii::t('dressing', 'Confirm ' . ucfirst($task)), 'htmlOptions' => array('class' => 'pull-right')));
echo '</div>';
$this->endWidget();
开发者ID:cornernote,项目名称:yii-dressing,代码行数:31,代码来源:delete.php


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