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


PHP Pages::update方法代码示例

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


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

示例1: updateProcess

function updateProcess($id)
{
    $send = Request::get('send');
    $valid = Validator::make(array('send.title' => 'min:1|slashes', 'send.content' => 'min:1', 'send.keywords' => 'slashes'));
    if (!$valid) {
        throw new Exception("Error Processing Request: " . Validator::getMessage());
    }
    $uploadMethod = Request::get('uploadMethod');
    $loadData = Pages::get(array('where' => "where pageid='{$id}'"));
    if (!isset($loadData[0]['pageid'])) {
        throw new Exception("This page not exists.");
    }
    switch ($uploadMethod) {
        case 'frompc':
            if (Request::hasFile('imageFromPC')) {
                if (Request::isImage('imageFromPC')) {
                    $send['image'] = File::upload('imageFromPC');
                    File::remove($loadData[0]['image']);
                }
            }
            break;
        case 'fromurl':
            if (Request::isImage('imageFromUrl')) {
                $url = Request::get('imageFromUrl');
                $send['image'] = File::upload('uploadFromUrl');
                File::remove($loadData[0]['image']);
            }
            break;
    }
    if (!Pages::update($id, $send)) {
        throw new Exception("Error. " . Database::$error);
    }
}
开发者ID:neworldwebsites,项目名称:noblessecms,代码行数:33,代码来源:pages.php

示例2: edit

 public function edit($id)
 {
     // find page
     if (($page = Pages::find(array('id' => $id))) === false) {
         return Response::redirect($this->admin_url . '/pages');
     }
     // process post request
     if (Input::method() == 'POST') {
         if (Pages::update($id)) {
             // redirect path
             return Response::redirect($this->admin_url . '/pages/edit/' . $id);
         }
     }
     Template::render('pages/edit', array('page' => $page));
 }
开发者ID:nathggns,项目名称:anchor-cms,代码行数:15,代码来源:pages.php

示例3: editAction

 function editAction()
 {
     $this->view->title = "Edit pages";
     $pages = new Pages();
     if ($this->_request->isPost()) {
         Zend_Loader::loadClass('Zend_Filter_StripTags');
         $filter = new Zend_Filter_StripTags();
         $this->view->headScript()->appendFile('/js/tiny_mce/tiny_mce.js', 'text/javascript');
         $id = (int) $this->_request->getPost('id');
         $name = $filter->filter($this->_request->getPost('name'));
         $name = trim($name);
         $body = $filter->filter($this->_request->getPost('body'));
         $body = trim($body);
         $title = trim($filter->filter($this->_request->getPost('title')));
         if ($id !== false) {
             if ($name != '' && $body != '' && $title != '') {
                 $data = array('name' => $name, 'body' => $body, 'title' => $title);
                 $where = 'id = ' . $id;
                 $pages->update($data, $where);
                 $this->_redirect('/admin');
                 return;
             } else {
                 $this->view->pages = $pages->fetchRow('id=' . $id);
             }
         }
     } else {
         // pages id should be $params['$id']
         $id = (int) $this->_request->getParam('id', 0);
         if ($id > 0) {
             $this->view->pages = $pages->fetchRow('id=' . $id);
         }
     }
     // additional view fields required by form
     $this->view->action = 'edit';
     $this->view->buttonText = 'Update';
 }
开发者ID:stasiu38,项目名称:cms,代码行数:36,代码来源:AdminController.php

示例4: update

 /**
  * Updates Pages into database.
  *
  * @param Pages $pages
  * @param array $input
  *
  * @return Pages
  */
 public function update($pages, $input)
 {
     $input['url'] = Quarx::convertToURL($input['url']);
     $input['is_published'] = isset($input['is_published']) ? (bool) $input['is_published'] : 0;
     $input['published_at'] = isset($input['published_at']) && !empty($input['published_at']) ? $input['published_at'] : Carbon::now()->format('Y-m-d h:i:s');
     return $pages->update($input);
 }
开发者ID:YABhq,项目名称:Quarx,代码行数:15,代码来源:PageRepository.php


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