本文整理汇总了PHP中yii::import方法的典型用法代码示例。如果您正苦于以下问题:PHP yii::import方法的具体用法?PHP yii::import怎么用?PHP yii::import使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii
的用法示例。
在下文中一共展示了yii::import方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionResetPersonPassword
/**
* send to user new password
* @return type
*/
public function actionResetPersonPassword($ccmp_id, $person_id)
{
//only for validation acces
$model = $this->loadModel($ccmp_id);
yii::import('vendor.dbrisinajumi.person.PersonModule');
//if do not have user, create
$m = Person::model();
$m->resetPassword($person_id);
$this->redirect(array('adminCustomers', 'ccmp_id' => $ccmp_id));
}
示例2: CHttpSession
<?php
$session = new CHttpSession();
$session->open();
$pid = base64_decode($_GET["id"]);
$sprint = @$_GET["s"] != '' ? base64_decode($_GET["s"]) : 1;
yii::import("application.model.webservice");
$wp = new Webservice();
$projectName = ProjectMaster::model()->projectName($pid);
$wp->getTaskByDateForChart($pid, $sprint);
$ps = StoriesTasks::model()->workProgressPercentage($pid, $sprint);
$progress = $ps["progress"];
$pers = $ps["p"];
?>
<!doctype html>
<html lang="en">
<head>
<title>Scrum Board</title>
<link rel="stylesheet" href="<?php
echo Yii::app()->request->baseUrl;
?>
/css/default.css">
<link rel="stylesheet" type="text/css" href="<?php
echo Yii::app()->request->baseUrl;
?>
/css/jquery-ui-1.10.3.custom/css/ui-lightness/jquery-ui-1.10.3.custom.css" />
<script type="text/javascript" src="<?php
echo Yii::app()->baseUrl . '/css/jquery-ui-1.10.3.custom/js/jquery-1.9.1.js';
?>
"></script>
<script type="text/javascript" src="<?php
示例3: array
<?php
/**
* EColumns class file.
*
* Allows to set column visibility and order in CGridView.
*
* @author Vitaliy Potapov <noginsk@rambler.ru>
*/
yii::import('zii.widgets.jui.CJuiSortable');
class EColumns extends CJuiSortable
{
/**
* array of columns with keys generated by column data (name. or class or etc)
*
* @var mixed
*/
public $columns = array();
public $storage = 'session';
public $gridId = null;
public $delimiter = '||';
public $buttonApply = '<input type="submit" value="Apply" style="float: left">';
public $buttonCancel = null;
public $buttonReset = '<input type="button" class="reset" value="Reset" style="float: right">';
public $model = null;
//model can be used to get attribute labels for header
public $itemTemplate = '<li class="ui-state-default" id="{id}">{content}</li>';
/**
* array of column names to be fixed (not sortable)
* @var mixed
*/
示例4: setSysConfig
}
if (isset($params['app']) and isset($params['view']) and $pagetype == 1) {
$cur_temp = "wapsite";
setSysConfig("sys.template", $cur_temp);
setSysConfig("sys.template.path", ROOT_PATH . "themes/{$cur_temp}/");
setSysConfig("sys.template.url", "/themes/{$cur_temp}/");
// thu tu uu tien: theme/$template => protected/apps/frontend/$app/views => /protected/views/frontend
if (isset($params['app'])) {
$yiiapp->setControllerPath(ROOT_PATH . 'protected/apps/frontend/' . $params['app'] . '/controllers/');
if (is_dir(ROOT_PATH . "themes/{$cur_temp}")) {
$yiiapp->setViewPath(ROOT_PATH . "themes/{$cur_temp}");
} else {
$yiiapp->setViewPath(ROOT_PATH . 'protected/apps/frontend/' . $params['app'] . '/views/');
}
} else {
$yiiapp->setControllerPath(ROOT_PATH . 'protected/controllers/frontend');
$yiiapp->setViewPath(ROOT_PATH . 'protected/views/frontend');
}
// $rt = $params['controller'] . "/".$params['action'];
if (!isset($params['layout'])) {
$params['layout'] = "display";
}
$rt = $params['view'] . "/" . $params['layout'];
yii::import('application.apps.frontend.' . $params['app'] . '.models.*');
$yiiapp->runController($rt);
} else {
$yiiapp->runEnd('frontend');
}
// setController setViewPath setLayoutPath
//$yiiapp->runEnd('frontend');
//Yii::createWebApplication($config)->runEnd('frontend');
示例5: authenticate
<?php
/**
* UserIdentity represents the data needed to identity a user.
* It contains the authentication method that checks if the provided
* data can identity the user.
*/
yii::import('application.modules.Configuracion.models.Usuario');
class UserIdentity extends CUserIdentity
{
private $_id;
/**
* Authenticates a user.
* The example implementation makes sure if the username and password
* are both 'demo'.
* In practical applications, this should be changed to authenticate
* against some persistent user identity storage (e.g. database).
* @return boolean whether authentication succeeds.
*/
public function authenticate()
{
// $users=array(
// // username => password
// 'demo'=>'demo',
// 'admin'=>'admin',
// );
$user = Usuario::model()->find('LOWER(login)=?', array(strtolower($this->username)));
if (!isset($user->login)) {
$this->errorCode = self::ERROR_USERNAME_INVALID;
} else {
if (!$user->validatePassword($this->password)) {
示例6: save
/**
* 保存上传文件
* @param file $file //上传文件
* @return boolean
*/
private function save($file)
{
$filename = $file['savepath'] . $file['savename'];
// 如果是图像文件 检测文件格式
if (in_array(strtolower($file['extension']), array('gif', 'jpg', 'jpeg', 'bmp', 'png', 'swf')) && false === getimagesize($file['tmp_name'])) {
$this->error = '非法文件';
return false;
}
if (!@move_uploaded_file($file['tmp_name'], $filename)) {
$this->error = '文件上传保存错误!';
return false;
}
//添加水印
if ($this->isWaterMark) {
yii::import('application.extensions.swfupload.Image');
Image::WaterMarkImg($filename, $this->wmPosition);
}
if ($this->thumb && in_array(strtolower($file['extension']), array('gif', 'jpg', 'jpeg', 'bmp', 'png'))) {
$image = getimagesize($filename);
if (false !== $image) {
// 图像文件生成缩略图
$thumbWidth = strrpos($this->thumbMaxWidth, ',') ? explode(',', $this->thumbMaxWidth) : $this->thumbMaxWidth;
$thumbHeight = strrpos($this->thumbMaxHeight, ',') ? explode(',', $this->thumbMaxHeight) : $this->thumbMaxHeight;
$thumbPrefix = strrpos($this->thumbPrefix, ',') ? explode(',', $this->thumbPrefix) : $this->thumbPrefix;
$thumbSuffix = strrpos($this->thumbSuffix, ',') ? explode(',', $this->thumbSuffix) : $this->thumbSuffix;
$thumbFile = strrpos($this->thumbFile, ',') ? explode(',', $this->thumbFile) : $this->thumbFile;
$thumbPath = $this->thumbPath ? $this->thumbPath : $file['savepath'];
$thumbPath = substr($thumbPath, -1, 1) == '/' ? $thumbPath : $thumbPath . '/';
if (!is_dir($thumbPath)) {
GlobalFunc::mk_dir($thumbPath);
}
Yii::import('application.extensions.swfupload.Image');
$realFilename = $this->autoSub ? basename($file['savename']) : $file['savename'];
if (is_array($thumbWidth)) {
for ($i = 0, $len = count($thumbWidth); $i < $len; $i++) {
if (!empty($thumbFile[$i])) {
$thumbname = $thumbPath . $thumbPrefix[$i] . $thumbFile . $thumbSuffix[$i] . '.' . $file['extension'];
} else {
$thumbname = $thumbPath . $thumbPrefix[$i] . substr($realFilename, 0, strrpos($realFilename, '.')) . $thumbSuffix[$i] . '.' . $file['extension'];
}
Image::thumb($filename, $thumbname, '', $thumbWidth[$i], $thumbHeight[$i], true);
}
} else {
if (!empty($thumbFile)) {
$thumbname = $thumbPath . $thumbPrefix . $thumbFile . $thumbSuffix . '.' . $file['extension'];
} else {
$thumbname = $thumbPath . $thumbPrefix . substr($realFilename, 0, strrpos($realFilename, '.')) . $thumbSuffix . '.' . $file['extension'];
}
Image::thumb($filename, $thumbname, '', $thumbWidth, $thumbHeight, true);
}
if ($this->thumbRemoveOrigin) {
// 生成缩略图之后删除原图
unlink($filename);
}
}
}
return true;
}
示例7: dirname
require_once dirname(__FILE__) . '/protected/backrouter.php';
require_once dirname(__FILE__) . '/protected/backfunctions.php';
$params = Router::parseLink($_SERVER['REQUEST_URI']);
global $pagetype, $cur_temp;
$debug = isset($_REQUEST['debug']) ? $_REQUEST['debug'] : 0;
$pagetype = 1;
$app = Request::getVar('app', "cpanel");
$view = Request::getVar('view', "home");
$layout = Request::getVar('layout', "display");
if ($app != null and $pagetype == 1) {
$cur_temp = "standard";
setSysConfig("sys.template", $cur_temp);
setSysConfig("sys.template.path", ROOT_PATH . "themes/backend/{$cur_temp}/");
setSysConfig("sys.template.url", "/themes/backend/{$cur_temp}/");
$_path_controller = ROOT_PATH . 'protected/apps/backend/' . $app . '/controllers/';
if (is_dir($_path_controller)) {
$yiiapp->setControllerPath($_path_controller);
} else {
die("Invalid app");
}
if (is_dir(ROOT_PATH . "themes/backend/{$cur_temp}")) {
$yiiapp->setViewPath(ROOT_PATH . "themes/backend/{$cur_temp}");
} else {
$yiiapp->setViewPath(ROOT_PATH . 'protected/apps/backend/' . $app . '/views/');
}
$rt = $view . "/" . $layout;
yii::import('application.apps.backend.' . $app . '.models.*');
$yiiapp->runController($rt);
} else {
$yiiapp->runEnd('backend');
}