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


PHP obj::update方法代码示例

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


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

示例1: update

 /**
  * 更新类别
  *
  * @param array $data 类别信息数组
  */
 public function update(array $data)
 {
     $node['cate_name'] = $data['cate_name'];
     $node['parent_id'] = $data['parent_id'];
     $node['sort_order'] = $data['sort_order'];
     $node['is_show'] = $data['is_show'];
     // 更新路径信息
     $node['path'] = $this->getPath($node['parent_id']) . $data['cate_id'] . ';';
     $where = $this->db->quoteInto('cate_id = ?', $data['cate_id']);
     $this->db->update('category', $node, $where);
     if (isset($data['is_show'])) {
         // 继承设置显示状态
         $childs = $this->getAllChilds($data['cate_id']);
         if (!empty($childs)) {
             $where = $this->db->quoteInto('cate_id in (?)', $childs);
             $this->db->update('category', array('is_show' => $data['is_show']), $where);
         }
     }
     $this->_allCates = null;
 }
开发者ID:BGCX261,项目名称:zhongyycode-svn-to-git,代码行数:25,代码来源:Cate.php

示例2: act_rename

 /**
  * 重命名文件
  *
  * @return bool
  * @author weizhifeng
  **/
 protected function act_rename()
 {
     if (!$this->check_time_out()) {
         $this->time_error_msg(Kohana::lang('o_kc.time_out'));
     }
     if ($this->config['readonly'] || !isset($this->post['file']) || !isset($this->post['new_name']) || !isset($this->post['file_id']) || !isset($this->post['dir_id'])) {
         $this->error_msg(Kohana::lang('o_kc.file_not_exist'));
     }
     $file_id = (int) $this->post['file_id'];
     $new_name = trim($this->post['new_name']);
     $old_name = trim($this->post['file']);
     $dir_id = (int) $this->post['dir_id'];
     if (!strlen($new_name)) {
         $this->error_msg(Kohana::lang('o_kc.enter_new_file_name'));
     }
     if (preg_match('/[\\/\\\\]/s', $new_name)) {
         $this->error_msg(Kohana::lang('file_name_have_unallow_char'));
     }
     if (substr($new_name, 0, 1) == ".") {
         $this->error_msg(Kohana::lang('o_kc.file_name_begin_with'));
     }
     if (strlen($new_name) >= 254) {
         $this->error_msg(Kohana::lang('o_kc.file_name_too_long'));
     }
     // 文件检查
     if ($new_name != $old_name and $this->file_exists(1, $dir_id, $new_name)) {
         $this->error_msg(Kohana::lang('o_kc.file_name_exist'));
     }
     $ext = kc_file::get_extension($new_name);
     if (!$this->validate_extension($ext, $this->type)) {
         $this->error_msg(Kohana::lang('o_kc.denied_file_extension'));
     }
     $data = array('image_name' => $new_name, 'date_upd' => date('Y-m-d H:i:s'));
     if ($this->kc_image->update($file_id, $data) === FALSE) {
         $this->error_msg(Kohana::lang('o_kc.file_rename_failed'));
     }
     $this->template->content = new View("kc_rename");
 }
开发者ID:RenzcPHP,项目名称:3dproduct,代码行数:44,代码来源:kc_browser.php

示例3: saveFBdetails

function saveFBdetails()
{
    $obj = new obj();
    $data = false;
    $_SESSION['fb_login'] = true;
    $_SESSION['fb_lastname'] = $_POST['fb_lastname'];
    $_SESSION['fb_firstname'] = $_POST['fb_firstname'];
    $_SESSION['fb_email'] = $_POST['fb_email'];
    $_SESSION['fb_pic'] = $_POST['fb_pic'];
    //CHECK IF EMAIL EXISTS
    $checkUser = $obj->singleData($_SESSION['fb_email'], "email", "tbl_ut_pass");
    if ($checkUser != NULL) {
        extract($checkUser);
        //IF ALREADY HAVE LC ACCOUNT
        if ($usertype == 1) {
            $usertype = 3;
            $fb_update = array('usertype' => $usertype);
            $obj->update('tbl_ut_pass', $fb_update, "WHERE uid = " . $uid);
            $_SESSION['uid'] = $uid;
        } else {
            $_SESSION['uid'] = $uid;
        }
    } else {
        $usertype = 2;
        $obj->newReg($_SESSION['fb_firstname'], $_SESSION['fb_lastname'], "tbl_ut_user");
        foreach ($obj->showLastId("tbl_ut_user", "uid") as $value) {
            extract($value);
            $_SESSION['uid'] = $value['uid'];
        }
        $fb_data = array('uid' => $uid, 'email' => $_SESSION['fb_email'], 'usertype' => $usertype);
        $obj->insert('tbl_ut_pass', $fb_data);
    }
    $_SESSION['user_lastname'] = $_POST['fb_lastname'];
    $_SESSION['user_firstname'] = $_POST['fb_firstname'];
    $_SESSION['user_pic'] = $_POST['fb_pic'];
    $data = $_SESSION['uid'];
    echo json_encode($data);
}
开发者ID:raymundcuizon,项目名称:lectureclip,代码行数:38,代码来源:api.php


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