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


PHP Topic::update方法代码示例

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


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

示例1: switch

                     }
                 }
                 break;
             default:
                 $errors['err']='Unknown action';
                 //print_r($_POST);
         }
         break;
 case 'topics':
     require_once(INCLUDE_DIR.'class.topic.php');
     $do=strtolower($_POST['do']);
     switch($do){
         case 'update':
             $topic = new Topic($_POST['topic_id']);
             if($topic && $topic->getId()) {
                 if($topic->update($_POST,$errors))
                     $msg='Topic updated successfully';
                 elseif(!$errors['err'])
                     $errors['err']='Error updating the topic';
             }else{
                 $errors['err']='Internal error';
             }
             break;
         case 'create':
             if(Topic::create($_POST,$errors))
                 $msg='Help topic created successfully';
             elseif(!$errors['err'])
                 $errors['err']='Unable to create the topic. Internal error';
             break;
         case 'mass_process':
             if(!$_POST['tids'] || !is_array($_POST['tids'])) {
开发者ID:hungnv0789,项目名称:vhtm,代码行数:31,代码来源:admin.php

示例2: update_topic

 public function update_topic()
 {
     if (!isset($_POST['topic_id'])) {
         error(__("Error"), __("No topic ID specified.", "discuss"));
     }
     $topic = new Topic($_POST['topic_id']);
     if ($topic->no_results) {
         error(__("Error"), __("Invalid topic ID specified.", "discuss"));
     }
     if (!$topic->editable()) {
         show_403(__("Access Denied"), __("You do not have sufficient privileges to edit this topic.", "discuss"));
     }
     $topic->update($_POST['title'], $_POST['description']);
     $files = array();
     foreach ($_FILES['attachment'] as $key => $val) {
         foreach ($val as $file => $attr) {
             $files[$file][$key] = $attr;
         }
     }
     foreach ($files as $attachment) {
         if ($attachment['error'] != 4) {
             $path = upload($attachment, null, "attachments");
             Attachment::add(basename($path), $path, "topic", $topic->id);
         }
     }
     Flash::notice(__("Topic updated.", "discuss"), $topic->url());
 }
开发者ID:vito,项目名称:chyrp-site,代码行数:27,代码来源:controller.Discuss.php

示例3: CategorieManager

        $manager = new CategorieManager($link);
        try {
            $manager->create($_POST['nom']);
        } catch (Exception $e) {
            $error = $e->getMessage();
        }
    } elseif (isset($_POST['delete'], $_GET['id'])) {
        $manager = new CategorieManager($link);
        $manager->delete($_GET['id']);
    } elseif (isset($_POST['update'], $_POST['nom'], $_GET['id'])) {
        $manager = new CategorieManager($link);
        $category = $manager->select($_GET['id']);
        $category->setTitre($_POST['nom']);
        $manager->update($category);
    } elseif (isset($_POST['update'], $_POST['statut'], $_GET['id'])) {
        $manager = new UserManager($link);
        $user = $manager->selectById($_GET['id']);
        $user->setStatut($_POST['statut']);
        $manager->update($user);
    } elseif (isset($_POST['bannir'], $_GET['id'])) {
        $manager = new UserManager($link);
        $user = $manager->selectById($_GET['id']);
        $manager->ban($user);
    } elseif (isset($_POST['reset'], $_GET['id'])) {
        // /!\
        $topic = new Topic($link);
        $message = $topic->selectById($_GET['id']);
        $message->resetSignalement();
        $topic->update($message);
    }
}
开发者ID:jmgerber,项目名称:forum,代码行数:31,代码来源:traitement-gestion.php

示例4: array

}
// Process reply
if (isset($_POST['edit_content'])) {
    // Create Data Array
    $data = array();
    $data['topic_id'] = $_GET['topic'];
    $data['body'] = $_POST['body'];
    // Getiing values from the SESSION vars
    $data['user_id'] = getUser()['user_id'];
    // Create Validator Object
    $validate = new Validator();
    // Required fields
    $field_array = array('body');
    if ($validate->isRequired($field_array)) {
        // Save Reply
        if ($topic->update($data)) {
            redirect('topic.php?id=' . $topic_id, 'Your post has succesfully saved', 'success');
        } else {
            redirect('topic.php?id=' . $topic_id, 'Something went wrong with your edit', 'error');
        }
    } else {
        redirect('topic.php?id=' . $topic_id, 'Your edit form is blank', 'error');
    }
}
// Get Template & Assign vars (Getting Template Obj)
$template = new Template('templates/editp.php');
//print_r($topic->getTopic($topic_id));
// Assign vars
$template->topicId = $topic_id;
$template->MainTopic = $topic->getTopic($topic_id);
$template->replies = $topic->getReplies($topic_id);
开发者ID:saptharsh,项目名称:Technology-Forum,代码行数:31,代码来源:editp.php

示例5: Topic

 function test_update()
 {
     $name = "Writing";
     $test_topic = new Topic($name);
     $test_topic->save();
     $name2 = "Interview";
     $test_topic->update($name2);
     $topics = Topic::getAll();
     $result = $topics[0]->getName();
     $this->assertEquals($name2, $result);
 }
开发者ID:umamiMike,项目名称:promptr,代码行数:11,代码来源:TopicTest.php


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