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


PHP Pages::save方法代码示例

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


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

示例1: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Pages();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Pages'])) {
         $model->attributes = $_POST['Pages'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->Objid));
         }
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:brahmajiayatas,项目名称:getweiss,代码行数:17,代码来源:PagesController.php

示例2: postCreate

 public function postCreate()
 {
     $page = new Pages();
     $page->name = Input::get('name');
     $page->title = Input::get('title');
     $page->content = Input::get('content');
     $page->status = Input::get('status');
     $page->url = Input::get('url');
     $page->id_parent = 0;
     $page->order = count(Pages::all());
     $page->save();
     return Redirect::to($this->route)->with('msg_success', Lang::get('messages.companies_create', array('title' => $page->title)));
 }
开发者ID:nagyist,项目名称:abge,代码行数:13,代码来源:PageController.php

示例3: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Pages();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Pages'])) {
         $model->attributes = $_POST['Pages'];
         if ($model->save()) {
             Yii::app()->user->setFlash('success', Yii::t('main', 'Данные успешно сохранены!'));
             $this->redirect(array('update', 'id' => $model->id));
         } else {
             Yii::app()->user->setFlash('error', Yii::t('main', 'Ошибка!'));
         }
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:Vladimirtishenko,项目名称:val.ua,代码行数:20,代码来源:PagesController.php

示例4: actionCreate

	/**
	 * Creates a new model.
	 * If creation is successful, the browser will be redirected to the 'view' page.
	 */
	public function actionCreate()
	{
		$model=new Pages;
		if(isset($_POST['Pages']))
		{
			$model->attributes=$_POST['Pages'];
            if($model->save()) {
                Yii::app()->user->setFlash('success', Yii::t('main', 'Данные успешно сохранены!'));
                $this->redirect(array('update','id'=>$model->id));
            } else {
                Yii::app()->user->setFlash('error', Yii::t('main', 'Ошибка сохранения данных!'));
            }
		}

		$this->render('create',array(
			'model'=>$model,
		));
	}
开发者ID:Vladimirtishenko,项目名称:garmata.tv,代码行数:22,代码来源:PagesController.php

示例5: page_add

/**
 * page_add 
 * 
 * @access public
 * @return string
 */
function page_add()
{
    $data = array();
    $page = new Pages();
    if (is_post()) {
        $page->fromArray($_POST);
        if ($page->isValid()) {
            $page->save();
            return redirect('/page/list');
        } else {
            $errors = array();
            $errors['page'] = get_errors($page);
            print_r($errors['page']);
        }
    }
    $data['page'] = $page;
    return render('page_form.tpl', $data);
}
开发者ID:jouvent,项目名称:Genitura,代码行数:24,代码来源:pages.php

示例6: actionCreate

 public function actionCreate()
 {
     $role_id = Users::model()->findByPk(Yii::app()->user->id)->role_id;
     if ($role_id != 7) {
         $this->pageTitle = 'Создание раздела';
         $model = new Pages();
         if (isset($_POST['Pages'])) {
             $model->attributes = $_POST['Pages'];
             if ($model->save()) {
                 $this->redirect(YII::app()->baseUrl . '/admin.php?r=pages/update&id=' . $model->id);
             } else {
                 $this->render('create', array('model' => $model));
             }
         } else {
             $this->render('create', array('model' => $model));
         }
     } else {
         $this->redirect(Yii::app()->baseUrl . '/admin.php?r=pages/access');
     }
 }
开发者ID:arduanov,项目名称:eco,代码行数:20,代码来源:PagesController.php

示例7: Pages

    } else {
        $section = Sections::where('name_of_section', '=', Input::get('page_section'))->first();
        $xmlFileName = $section->section_url . '\\' . Input::get('page_shortname') . '.xml';
        $page = new Pages();
        $page->page_description = Input::get('page_description');
        $page->page_name = Input::get('page_name');
        $page->type_of_page = Input::get('type_of_page');
        $page->page_title = Input::get('page_title');
        $page->page_subtitle = Input::get('page_subtitle') . ": " . Input::get('page_description');
        $page->page_section = Input::get('page_section');
        $page->page_link_value = $section->shortname . "/" . Input::get('page_shortname');
        $page->color_code = Input::get('color_code');
        $page->page_shortname = Input::get('page_shortname');
        $page->page_url = $xmlFileName;
        //
        $page->save();
    }
    return Redirect::to('/add')->withMessage('Page created successfully');
});
Route::post('addPageDetails', function () {
    if (Input::hasFile('image')) {
        $image = Input::file('image');
        $name = $image->getClientOriginalName();
    }
    $oldPage = Pages::where('id', '=', Input::get('id'))->first();
    if (File::exists($oldPage->page_url)) {
        File::delete($oldPage->page_url);
    }
    $rule = array('page_description' => 'required', 'page_name' => 'required', 'page_title' => 'required', 'page_subtitle' => 'required', 'type_of_page' => 'required', 'page_section' => 'required', 'page_shortname' => 'required');
    $validator = Validator::make(Input::all(), $rule);
    if ($validator->fails()) {
开发者ID:GrameenGhana,项目名称:cch-pointofcarecms-webapp,代码行数:31,代码来源:routes.php

示例8: savepage

 public function savepage()
 {
     if (Input::get('pageid')) {
         $page = Pages::find(Input::get('pageid'));
     } else {
         $page = new Pages();
     }
     $page->slug = Input::get('page_slug');
     $page->title = Input::get('title');
     $page->subtitle = Input::get('subtitle');
     $page->content = Input::get('content');
     $page->status = Input::get('status');
     $page->save();
     if (Input::get('saveclose')) {
         return Redirect::to('backend/pages/')->withMessage($this->notifyView(Lang::get('laracms::messages.page_saved')));
     } else {
         return Redirect::to('backend/editpage/' . $page->id)->withMessage($this->notifyView(Lang::get('laracms::messages.page_saved')));
     }
 }
开发者ID:basdog22,项目名称:laracms,代码行数:19,代码来源:LaraBackendController.php

示例9: actionUpload

 public function actionUpload()
 {
     //$path = Yii::app()->baseUrl."/uploads";
     $model = new XUploadForm();
     if (!isset($this->path)) {
         $this->path = realpath(Yii::app()->basePath . "/../uploads");
     }
     if (!is_dir($this->path)) {
         throw new CHttpException(500, "{$this->path} does not exists.");
     } else {
         if (!is_writable($this->path)) {
             throw new CHttpException(500, "{$this->path} is not writable.");
         }
     }
     if ($model->validate()) {
         $model->file = CUploadedFile::getInstance($model, 'file');
         $model->mime_type = $model->file->getType();
         $model->size = $model->file->getSize();
         $model->name = $model->file->getName();
         $path = $this->path . "/" . Yii::app()->session['userId'];
         $model->file->saveAs($path . $model->name);
         $pageImage = new Pages();
         $pageImage->user_id = Yii::app()->user->userId;
         $pageImage->image = $model->name;
         $pageImage->save();
         Yii::app()->session['pageId'] = $pageImage->id;
         Yii::app()->session['imageName'] = $model->name;
         echo json_encode(array("name" => $model->name, "type" => $model->mime_type, "size" => $model->getReadableFileSize()));
         /*            $user_id = Yii::app()->session['userId'];
                     if ($model->file->getType() != 'image/jpeg' && $model->file->getType() !='image/png' && $model->file->getType() !='image/bmp' && $model->file->getType() != 'image/jpg')
                     {
                         echo "Invalid File Type, only jpg allowed";
                     }
                     else
                     {
                         $profile = UserProfile::model()->find('user_id=:id', array('id' => Yii::app()->session['userId']));
                         $old_pic = $profile['photo'];
                         if ((strpos($old_pic, "h")) === 0)
                         {
                             $profile->photo = Yii::app()->session['userId'] . '_' . $model->name;
                             $profile->save();
                             $model->file->saveAs($path . '_' . $model->name);
                             //Yii::app()->user->setFlash('success', "Upload Picture Successfully");
                         }
                         elseif ((strpos($old_pic, $profile['user_id'])) === 0)
                         {
                             unlink(realpath(Yii::app()->getBasePath() . "/../images/uploads") . "/" . urldecode($old_pic));
                             $profile->photo = Yii::app()->session['userId'] . '_' . $model->name;
                             $profile->save();
                             $model->file->saveAs($path . '_' . $model->name);
                             //Yii::app()->user->setFlash('success', "Upload Picture Successfully");
                         }
                         else
                         {
                             //unlink(realpath(Yii::app()->getBasePath()."/../images/uploads")."/".urldecode($old_pic));
                             //$profile->photo = Yii::app()->session['userId'] . '_' . $model->name;
                             //$profile->save();
                             //$model->file->saveAs($path . '_' . $model->name);
                             //Yii::app()->user->setFlash('success', "Upload Picture Successfully");
                         }
                         echo json_encode(array("name" => $model->name,"type" => $model->mime_type,"size"=> $model->getReadableFileSize()));
                         //echo "hogya hai ";
                         //$this->redirect(Yii::app()->baseUrl.'/index.php/user/userprofile/'.$user_id);
                         //echo '<script type="text/javascript">window.top.href = "' . Yii::app()->baseUrl . '/index.php/user/userprofile/' . $user_id . '"; </script>';
                     }
                 }
                 else
                 {
                     /*echo CVarDumper::dumpAsString($model->getErrors());
                       Yii::log("XUploadAction: ".CVarDumper::dumpAsString($model->getErrors()), CLogger::LEVEL_ERROR, "application.extensions.xupload.actions.XUploadAction");
                       throw new CHttpException(500, "Could not upload file"); */
         //echo $this->redirect(Yii::app()->baseUrl);
         //echo "<script type='text/javascript'>alert('chage');</script>";
     }
     /*  $model=new Image;
         if(isset($_POST['Image']))
         {
             $model->attributes=$_POST['Image'];
             $model->image=CUploadedFile::getInstance($model,'image');
             
             $fileTempName=$model->thumbnail->tempName;
             $fileName=$model->thumbnail->name;
             
             if($model->save())
             {
                 $userId=Yii::app()->session['userId'];
                 $upload_dir=realpath(getcwd()).'/images/uploads/';                 
                 move_uploaded_file($fileTempName, "$upload_dir/$userId".'_'."$fileName");
                 // $model->image->saveAs('path/to/localFile');
                 // redirect to success page
                 return;
             }
             return;
         }*/
     //$this->render('create', array('model'=>$model));
 }
开发者ID:nomannoor,项目名称:social-property,代码行数:96,代码来源:PagesController.php

示例10: actionCreate

 public function actionCreate()
 {
     $this->breadcrumbs = array_merge($this->breadcrumbs, array('Создание страницы'));
     $this->pageTitle = Yii::t('app', 'Создание страницы');
     $model = new Pages();
     $modelLang = new PagesLang();
     if (Yii::app()->request->getPost('Pages')) {
         $model->attributes = Yii::app()->request->getPost('Pages');
         $modelLang->attributes = Yii::app()->request->getPost('PagesLang');
         $transaction = Yii::app()->db->beginTransaction();
         try {
             $model->validate();
             if (!$model->save()) {
                 throw new Exception('Ошибка при сохранении данных.');
             }
             $modelLang->page_id = $model->id;
             $modelLang->lang = Yii::app()->sourceLanguage;
             $modelLang->langs = "|" . Yii::app()->sourceLanguage . "|";
             if (!$modelLang->save()) {
                 throw new Exception('Ошибка при сохранении данных.');
             }
             $transaction->commit();
             Yii::app()->user->setFlash('success', Yii::t('app', 'Страница успешно создана'));
             Yii::app()->request->redirect($this->createUrl('index'));
         } catch (Exception $e) {
             $transaction->rollBack();
             $error = $e->getMessage();
         }
     }
     $this->render('create', array('model' => $model, 'modelLang' => $modelLang));
 }
开发者ID:Wiedzal,项目名称:araucano,代码行数:31,代码来源:DefaultController.php

示例11: add_page


//.........这里部分代码省略.........
             $detailVisible = '0';
         }
         if (empty($detailVisible)) {
             $detailVisible = '0';
         }
         $isMenu = Input::get("isMenu");
         if ($isMenu == '1') {
             $isMenu = '1';
         } else {
             $isMenu = '0';
         }
         if (empty($isMenu)) {
             $isMenu = '0';
         }
         $detailParent = Input::get("detailParent");
         if (empty($detailParent)) {
             $detailParent = '';
         }
         if ($detailType == '1') {
             $detailContent = Input::get("detailContent_1");
         } else {
             $detailContent = Input::get("detailContent_2");
         }
         if (empty($detailContent)) {
             $detailContent = '';
         }
         $buttonName = Input::get("buttonName");
         if (empty($buttonName)) {
             $buttonName = '';
         }
         $filename_Button = '';
         if (Input::hasfile('filebuttonPicture')) {
             $file_Button = Input::file("filebuttonPicture");
             $filename_Button = $file_Button->getClientOriginalName();
             $upload_success_button = $file_Button->move($destinationPath_Button, $filename_Button);
         }
         if (empty($filename_Button)) {
             $filename_Button = '';
         }
         $typeOrder = Input::get("typeOrder");
         if (!empty($typeOrder)) {
             $typeOrder = '';
         }
         if ($detailId == '' || $detailKeyword == '' || $detailDescription == '' || $detailKeyTitle == '' || $detailName == '' || $detailTitle == '' || $detailName == '' || $detailTitle == '' || $detailUrl == '' || $detailContent == '' || $total_files == '' || $detailVisible == '' || $buttonName == '' || ($filename_Button = '')) {
             Session::flash('error', '$$$ --- Please input all of informations in the blanks  --- $$$');
             return Redirect::to('qlm-admin/add-new-page');
         } else {
             $_page = new Pages();
             $_page->detailId = $detailId;
             $_page->detailType = $detailType;
             $_page->detailKeyword = $detailKeyword;
             $_page->detailDescription = $detailDescription;
             $_page->detailKeyTitle = $detailKeyTitle;
             $_page->detailName = $detailName;
             $_page->detailTitle = $detailTitle;
             $_page->detailUrl = $detailUrl;
             $_page->detailParent = $detailParent;
             $_page->detailContent = $detailContent;
             $_page->detailTextImage = $total_files;
             $_page->detailVisible = $detailVisible;
             $_userData = Session::get('login');
             $_page->detailCreater = $_userData["username"];
             $_page->detailCreatedDate = date("Y-m-d H:i:s");
             if ($detailType == 1) {
                 $filename_Banner = null;
                 if (Input::hasfile('input-banner-id')) {
                     $file_Banner = Input::file("input-banner-id");
                     $filename_Banner = $file_Banner->getClientOriginalName();
                     $upload_success_banner = $file_Banner->move($destinationPath_BannerImage, $filename_Banner);
                 }
                 $detailBannerTitle = Input::get("detailBannerTitle");
                 if (empty($detailBannerTitle)) {
                     $detailBannerTitle = '';
                 }
                 $detailBannerDescription = Input::get("detailBannerDescription");
                 if (empty($detailBannerDescription)) {
                     $detailBannerDescription = '';
                 }
                 if (empty($filename_Banner)) {
                     $filename_Banner = '';
                 }
                 $_page->detailBannerImage = $filename_Banner;
                 if ($detailBannerTitle == '' || $detailBannerDescription == '' || $filename_Banner == '') {
                     Session::flash('error', '$$$ --- Please input all of informations in the blanks  --- $$$');
                     return Redirect::to('qlm-admin/add-new-page');
                 }
             }
             $_page->buttonName = $buttonName;
             $_page->buttonPicture = $filename_Button;
             $_page->typeOrder = $typeOrder;
             $_page->isMenu = $isMenu;
             $_page->detailTemplate = 'TQLM001';
             $_page->save();
         }
     } catch (Exception $_ex) {
         Session::flash('error', '$$$ --- Error (' . $_ex->getMessage() . ') --- $$$');
     }
     Session::flash('success', '$$$ --- Add Page Successfully  --- $$$');
     return Redirect::to('qlm-admin/add-new-page/' . $detailUrl);
 }
开发者ID:ndmson,项目名称:QLM,代码行数:101,代码来源:AdminController.php


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