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


PHP PIUrl类代码示例

本文整理汇总了PHP中PIUrl的典型用法代码示例。如果您正苦于以下问题:PHP PIUrl类的具体用法?PHP PIUrl怎么用?PHP PIUrl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: actionLogin

 /**
  * Displays the login page
  */
 public function actionLogin()
 {
     if (Yii::app()->user->isGuest) {
         $model = new UserLogin();
         // collect user input data
         if (isset($_POST['UserLogin'])) {
             $model->attributes = $_POST['UserLogin'];
             // validate user input and redirect to previous page if valid
             if ($model->validate()) {
                 $this->lastViset();
                 if (Yii::app()->user->returnUrl == '/index.php') {
                     $this->redirect(Yii::app()->controller->module->returnUrl);
                 } else {
                     if (isAdmin()) {
                         $this->redirect(PIUrl::createUrl('/admin'));
                     }
                     $this->redirect(Yii::app()->user->returnUrl);
                 }
             }
         }
         // display the login form
         $this->render('/user/login', array('model' => $model));
     } else {
         if (isAdmin()) {
             $this->redirect(PIUrl::createUrl('/admin'));
         }
         $this->redirect(Yii::app()->controller->module->returnUrl);
     }
 }
开发者ID:phiphi1992,项目名称:alongaydep,代码行数:32,代码来源:LoginController.php

示例2: actionIndex

 public function actionIndex()
 {
     if (!empty($_POST)) {
         $images = CUploadedFile::getInstancesByName('images');
         if (isset($images) && count($images) > 0) {
             // go through each uploaded image
             foreach ($images as $image => $pic) {
                 $model = new Images();
                 $imageType = explode('.', $pic->name);
                 $imageType = $imageType[count($imageType) - 1];
                 $imageName = md5(uniqid()) . '.' . $imageType;
                 if ($pic->saveAs(Yii::getPathOfAlias('webroot') . '/upload/images/' . $imageName)) {
                     $model->image = $imageName;
                     $model->name = $pic->name;
                     $model->created = time();
                     $model->save();
                     Yii::app()->user->setFlash('success', translate('Thêm thành công.'));
                 }
                 // handle the errors here, if you want
             }
         }
         $this->redirect(PIUrl::createUrl('/admin/images/index/'));
     }
     $criteria = new CDbCriteria();
     $criteria->order = 'id DESC';
     $count = Images::model()->count($criteria);
     $pages = new CPagination($count);
     // results per page
     $pages->pageSize = 18;
     $pages->applyLimit($criteria);
     $model = Images::model()->findAll($criteria);
     $this->render('index', compact('model', 'pages'));
 }
开发者ID:phiphi1992,项目名称:alongaydep,代码行数:33,代码来源:ImagesController.php

示例3: actionIndex

 public function actionIndex()
 {
     $model = Teachers::model()->find();
     $flag = 0;
     $flag1 = 0;
     if (!empty($_POST['Teachers'])) {
         $image1_old = $model->attributes['image1'];
         if (!empty(CUploadedFile::getInstance($model, 'image1')->name)) {
             $image1_old = $model->attributes['image1'];
             $path = realpath(Yii::app()->basePath . '/../upload/images/' . $image1_old);
             if (file_exists($path) && !empty($image1_old)) {
                 unlink($path);
             }
             $model->attributes = $_POST['Teachers'];
             $model->image1 = CUploadedFile::getInstance($model, 'image1');
             $image = $model->image1;
             $imageType = explode('.', $model->image1->name);
             $imageType = $imageType[count($imageType) - 1];
             $imageName = md5(uniqid()) . '.' . $imageType;
             $model->image1 = $imageName;
             $images_path = Yii::getPathOfAlias('webroot') . '/upload/images/' . $imageName;
             $flag = 1;
         } else {
             $model->image1 = $image1_old;
             $model->attributes = $_POST['Teachers'];
         }
         $image2_old = $model->attributes['image2'];
         if (!empty(CUploadedFile::getInstance($model, 'image2')->name)) {
             $image2_old = $model->attributes['image2'];
             $path = realpath(Yii::app()->basePath . '/../upload/images/' . $image2_old);
             if (file_exists($path) && !empty($image2_old)) {
                 unlink($path);
             }
             $model->image2 = CUploadedFile::getInstance($model, 'image2');
             $image1 = $model->image2;
             $imageType = explode('.', $model->image2->name);
             $imageType = $imageType[count($imageType) - 1];
             $imageName = md5(uniqid()) . '.' . $imageType;
             $model->image2 = $imageName;
             $images_path1 = Yii::getPathOfAlias('webroot') . '/upload/images/' . $imageName;
             $flag1 = 1;
         } else {
             $model->image2 = $image2_old;
             $model->attributes = $_POST['Teachers'];
         }
         if ($model->save()) {
             Yii::app()->user->setFlash('success', translate('Cập nhật thành công.'));
             if ($flag == 1) {
                 $image->saveAs($images_path);
             }
             if ($flag1 == 1) {
                 $image1->saveAs($images_path1);
             }
             $this->redirect(PIUrl::createUrl('/admin/teachers'));
         }
     }
     $this->render('index', array('model' => $model));
 }
开发者ID:phiphi1992,项目名称:fpthue,代码行数:58,代码来源:TeachersController.php

示例4: actionDelete

 public function actionDelete($id, $is_product)
 {
     $model = $this->loadModel($id);
     $path = "/../upload/images/";
     $name = $model->image;
     $this->unlink($path, $name);
     $model->delete();
     Yii::app()->user->setFlash('success', translate('Xóa thành công.'));
     // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
     $this->redirect(PIUrl::createUrl('/admin/slides/index', array('is_product' => $is_product)));
 }
开发者ID:phiphi1992,项目名称:alongaydep,代码行数:11,代码来源:SlidesController.php

示例5: actionUpdate

 public function actionUpdate($id = null)
 {
     $model = Videos::model()->findByPk($id);
     if (isset($_POST['Videos'])) {
         $model->attributes = $_POST['Videos'];
         if ($model->save()) {
             Yii::app()->user->setFlash('success', translate('Cập nhập thành công.'));
             $this->redirect(PIUrl::createUrl('/admin/videos/index'));
         }
     }
     $this->render('update', array('model' => $model));
 }
开发者ID:phiphi1992,项目名称:fpthue,代码行数:12,代码来源:VideosController.php

示例6: actionIndex

 public function actionIndex()
 {
     $model = Links::model()->find();
     if (!empty($_POST['Links'])) {
         $model->attributes = $_POST['Links'];
         if ($model->save()) {
             Yii::app()->user->setFlash('success', translate('Cập nhật thành công.'));
             $this->redirect(PIUrl::createUrl('/admin/links'));
         }
     }
     $this->render('index', array('model' => $model));
 }
开发者ID:phiphi1992,项目名称:fpthue,代码行数:12,代码来源:LinksController.php

示例7: actionUpdate

 public function actionUpdate($id = null)
 {
     $model = Provinces::model()->findByPk($id);
     $flag = 0;
     if (!empty($_POST['Provinces'])) {
         $model->attributes = $_POST['Provinces'];
         if ($model->save()) {
             Yii::app()->user->setFlash('success', translate('Cập nhập thành công.'));
             $this->redirect(PIUrl::createUrl('/admin/provinces/'));
         }
     }
     $this->render('update', array('model' => $model));
 }
开发者ID:phiphi1992,项目名称:alongaydep,代码行数:13,代码来源:ProvincesController.php

示例8: actionUpdate

 public function actionUpdate($id = null)
 {
     $model = GroupSupport::model()->findByPk($id);
     if (isset($_POST['GroupSupport'])) {
         $model->attributes = $_POST['GroupSupport'];
         $model->created = time();
         if ($model->save()) {
             Yii::app()->user->setFlash('success', translate('Cập nhập nhóm hổ trợ thành công.'));
             $this->redirect(PIUrl::createUrl('/admin/groupSupport/index'));
         }
     }
     $this->render('update', array('model' => $model));
 }
开发者ID:phiphi1992,项目名称:alongaydep,代码行数:13,代码来源:GroupSupportController.php

示例9: actionCreate

 public function actionCreate()
 {
     $model = new QuestionAnswers();
     if (isset($_POST['QuestionAnswers'])) {
         $model->attributes = $_POST['QuestionAnswers'];
         $model->created = time();
         if ($model->save()) {
             Yii::app()->user->setFlash('success', translate('Thêm thành công.'));
             $this->redirect(PIUrl::createUrl('/admin/questionAnswers/index'));
         }
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:phiphi1992,项目名称:alongaydep,代码行数:13,代码来源:QuestionAnswersController.php

示例10: actionUpdate

 public function actionUpdate($id = null)
 {
     $model = Wards::model()->findByPk($id);
     if (!empty($_POST['Wards'])) {
         $model->attributes = $_POST['Wards'];
         $model->province_id = $_POST['Wards']['province_id'];
         if ($model->save()) {
             Yii::app()->user->setFlash('success', translate('Cập nhập thành công.'));
             $this->redirect(PIUrl::createUrl('/admin/Wards/'));
         }
     }
     $dataProvinces = Provinces::model()->getData();
     $this->render('update', array('model' => $model, 'dataProvinces' => $dataProvinces));
 }
开发者ID:phiphi1992,项目名称:alongaydep,代码行数:14,代码来源:WardsController.php

示例11: actionUpdate

 public function actionUpdate($id = null)
 {
     $model = ProductCategory::model()->findByPk($id);
     if (isset($_POST['ProductCategory'])) {
         $model->attributes = $_POST['ProductCategory'];
         $model->updated = time();
         $model->type = $id;
         if ($model->save()) {
             Yii::app()->user->setFlash('success', translate('Cập nhập thành công.'));
             $this->redirect(PIUrl::createUrl('/admin/productCategory/index', array('id' => $id)));
         }
     }
     $this->render('update', array('model' => $model));
 }
开发者ID:phiphi1992,项目名称:alongaydep,代码行数:14,代码来源:ProductCategoryController.php

示例12: actionUpdate

 public function actionUpdate($id = null)
 {
     $model = Supports::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException('404', 'Không tìm thấy trang.');
     }
     if (isset($_POST['Supports'])) {
         $model->attributes = $_POST['Supports'];
         if ($model->save()) {
             Yii::app()->user->setFlash('success', translate('Cập nhập thành công.'));
             $this->redirect(PIUrl::createUrl('/admin/support/index'));
         }
     }
     $this->render('update', array('model' => $model));
 }
开发者ID:phiphi1992,项目名称:fpthue,代码行数:15,代码来源:SupportController.php

示例13: actionDelete

 public function actionDelete($id)
 {
     $model = Slides::model()->findByPk($id);
     if ($model == null) {
         $this->redirect(PIUrl::createUrl('/admin/slides/index/'));
     }
     $name = $model->attributes['image'];
     $this->loadModel($id)->delete();
     if (file_exists(Yii::app()->basePath . '/upload/images/' . $name) && $name->image != '') {
         unlink(Yii::app()->basePath . '/upload/images/' . $name);
     }
     Yii::app()->user->setFlash('success', translate('Xóa thành công.'));
     // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
     $this->redirect(PIUrl::createUrl('/admin/slides'));
 }
开发者ID:phiphi1992,项目名称:fpthue,代码行数:15,代码来源:SlidesController.php

示例14: actionUpdate

 public function actionUpdate($id = null)
 {
     $model = CategoriesNews::model()->findByPk($id);
     if (isset($_POST['CategoriesNews'])) {
         $model->attributes = $_POST['CategoriesNews'];
         $model->created = time();
         if (!empty($_POST['CategoriesNews']['parent_id'])) {
             $model->parent_id = $_POST['CategoriesNews']['parent_id'];
         } else {
             $model->parent_id = 0;
         }
         if ($model->save()) {
             Yii::app()->user->setFlash('success', translate('Cập nhập thành công.'));
             $this->redirect(PIUrl::createUrl('/admin/categoriesNews/index'));
         }
     }
     $arrCate = CategoriesNews::model()->getDataCategories1();
     $this->render('update', array('model' => $model, 'arrCate' => $arrCate));
 }
开发者ID:phiphi1992,项目名称:alongaydep,代码行数:19,代码来源:CategoriesNewsController.php

示例15: actionIndex

 public function actionIndex($id = 0)
 {
     $model = Informations::model()->findByPK($id);
     if (empty($model)) {
         $model = new Informations();
     }
     $flag = 0;
     if (!empty($_POST['Informations'])) {
         if (!empty(CUploadedFile::getInstance($model, 'image')->name)) {
             $image_old = $model->attributes['image'];
             $path = realpath(Yii::app()->basePath . '/../upload/images/' . $image_old);
             if (file_exists($path) && !empty($image_old)) {
                 unlink($path);
             }
             $model->attributes = $_POST['Informations'];
             $model->image = CUploadedFile::getInstance($model, 'image');
             $image = $model->image;
             $imageType = explode('.', $model->image->name);
             $imageType = $imageType[count($imageType) - 1];
             $imageName = md5(uniqid()) . '.' . $imageType;
             $model->image = $imageName;
             $images_path = Yii::getPathOfAlias('webroot') . '/upload/images/' . $imageName;
             $flag = 1;
         } else {
             $arr = $_POST['Informations'];
             $model->attributes = $arr;
         }
         $model->created = time();
         $model->alias = alias($_POST['Informations']['name']);
         if ($model->save()) {
             Yii::app()->user->setFlash('success', translate('Cập nhật thành công.'));
             if ($flag == 1) {
                 $image->saveAs($images_path);
             }
             if ($id != 0) {
                 $this->redirect(PIUrl::createUrl('/admin/informations/', array('id' => $id)));
             } else {
                 $this->redirect(PIUrl::createUrl('/admin/informations/'));
             }
         }
     }
     $this->render('index', array('model' => $model));
 }
开发者ID:phiphi1992,项目名称:alongaydep,代码行数:43,代码来源:InformationsController.php


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