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


PHP Question::delete方法代码示例

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


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

示例1: delete

 function delete()
 {
     $this->is_loggedin();
     global $runtime;
     $to_trash = new Question($runtime['ident']);
     $to_trash->delete();
     redirect('questions/all');
 }
开发者ID:stas,项目名称:bebuntu,代码行数:8,代码来源:questions-controller.php

示例2: delete

 function delete($id = NULL)
 {
     if ($id) {
         $question = new Question($id);
         $question->delete();
         set_notify('success', lang('delete_data_complete'));
     }
     redirect('questions');
 }
开发者ID:unisexx,项目名称:thaigcd2015,代码行数:9,代码来源:questions.php

示例3: edit

 /**
  * Edit enquete
  * @global object $db  Database object used to communicate with MySQL database
  * @param string $name New name of the enquete
  * @param string $introduction New introduction o
  * @param date $start_date New start date on which the enquete will start
  * @param date $end_date New end date on which the enquete wil end
  * @param array$questions New questions of the enquete
  * @param array $deleted_questions Ids of the deleted questions
  * @param array $deleted_attributes Ids of the deleted attributes
  * @param int $enquete_id The id of the enquete 
  * @param int $user_id The id of the user who edited the enquete
  */
 static function edit($name, $introduction, $start_date, $end_date, $questions, $deleted_questions, $deleted_attributes, $enquete_id, $user_id)
 {
     global $db;
     $data = array("name" => $name, "introduction" => $introduction, "start_date" => $start_date, "end_date" => $end_date, "Users_id" => $user_id);
     $db->update('Enquetes', $data, "id = {$enquete_id}");
     foreach ($questions as $question) {
         if (isset($question['id'])) {
             Question::edit($question, $deleted_attributes);
         } else {
             Question::make($question, $enquete_id);
         }
     }
     if (!empty($deleted_questions) && count($deleted_questions) > 0) {
         foreach ($deleted_questions as $deleted_question) {
             Question::delete($deleted_question);
         }
     }
 }
开发者ID:DvOtterloo,项目名称:Questionmark,代码行数:31,代码来源:enquete.php

示例4: DialogBox

$dialogBox = new DialogBox();
/*
 * Execute commands
 */
// use question in exercise
if ($cmd == 'rqUse' && !is_null($quId) && !is_null($exId)) {
    if ($exercise->addQuestion($quId)) {
        // TODO show confirmation and back link
        header('Location: ' . Url::Contextualize('edit_exercise.php?exId=' . $exId));
    }
}
// delete question
if ($cmd == 'delQu' && !is_null($quId)) {
    $question = new Question();
    if ($question->load($quId)) {
        if (!$question->delete()) {
            // TODO show confirmation and list
        }
    }
}
// export question
if ($cmd == 'exExport' && get_conf('enableExerciseExportQTI')) {
    require_once '../export/qti2/qti2_export.php';
    require_once get_path('incRepositorySys') . '/lib/fileManage.lib.php';
    require_once get_path('incRepositorySys') . '/lib/file.lib.php';
    require_once get_path('incRepositorySys') . '/lib/thirdparty/pclzip/pclzip.lib.php';
    $question = new Qti2Question();
    $question->load($quId);
    // contruction of XML flow
    $xml = $question->export();
    // remove trailing slash
开发者ID:rhertzog,项目名称:lcs,代码行数:31,代码来源:question_pool.php

示例5: intval

define('QUESTIONS_PER_PAGE', 15);
if (!isset($_GET['page'])) {
    $page = 0;
} else {
    $page = $_GET['page'];
}
if ($is_editor) {
    // deletes a question from the data base and all exercises
    if (isset($_GET['delete'])) {
        $delete = intval($_GET['delete']);
        // construction of the Question object
        $objQuestionTmp = new Question();
        // if the question exists
        if ($objQuestionTmp->read($delete)) {
            // deletes the question from all exercises
            $objQuestionTmp->delete();
        }
        // destruction of the Question object
        unset($objQuestionTmp);
        //Session::set_flashdata($message, $class);
        redirect_to_home_page("modules/exercise/question_pool.php?course={$course_code}" . (isset($fromExercise) ? "&fromExercise={$fromExercise}" : "") . "&exerciseId={$exerciseId}");
    } elseif (isset($_GET['recup']) && isset($fromExercise)) {
        $recup = intval($_GET['recup']);
        // construction of the Question object
        $objQuestionTmp = new Question();
        // if the question exists
        if ($objQuestionTmp->read($recup)) {
            // adds the exercise ID into the list of exercises for the current question
            $objQuestionTmp->addToList($fromExercise);
        }
        // destruction of the Question object
开发者ID:kostastzo,项目名称:openeclass,代码行数:31,代码来源:question_pool.php

示例6: connectToEncryptedMySQL

<?php

require_once "/etc/apache2/capstone-mysql/encrypted-config.php";
require_once "question.php";
$pdo = connectToEncryptedMySQL("/etc/apache2/data-design/jfindley2.ini");
$question = new Question(null, 1, 2, "Huh?", null);
$question->insert($pdo);
$question->setQuestionText("What?");
$question->update($pdo);
$question->delete($pdo);
开发者ID:jfindley2,项目名称:amazon-product,代码行数:10,代码来源:question-shakedown.php

示例7: deleteCustom

 public static function deleteCustom()
 {
     RecruiterController::requireLogin();
     global $params;
     $questionId = new MongoId($params['questionId']);
     $jobId = new MongoId($params['jobId']);
     $recruiterId = $_SESSION['_id'];
     $question = Question::getById($questionId);
     if ($question->getVanilla() == true) {
         return;
     }
     $usesCount = $question->getUsesCount();
     // Delete question only if 'uses' is 0,
     if ($usesCount == 0) {
         return Question::delete($questionId);
     }
 }
开发者ID:davidliuliuliu,项目名称:sublite,代码行数:17,代码来源:ApplicationControllerAJAX.php

示例8: Question

    redirect_to_home_page("modules/exercise/admin.php?course={$course_code}&exerciseId={$exerciseId}");
}
// moves a question down in the list
if (isset($_GET['moveDown'])) {
    $objExercise->moveDown($_GET['moveDown']);
    $objExercise->save();
    redirect_to_home_page("modules/exercise/admin.php?course={$course_code}&exerciseId={$exerciseId}");
}
// deletes a question from the exercise (not from the data base)
if (isset($_GET['deleteQuestion'])) {
    $deleteQuestion = $_GET['deleteQuestion'];
    // construction of the Question object
    $objQuestionTmp = new Question();
    // if the question exists
    if ($objQuestionTmp->read($deleteQuestion)) {
        $objQuestionTmp->delete($exerciseId);
        // if the question has been removed from the exercise
        if ($objExercise->removeFromList($deleteQuestion)) {
            $nbrQuestions--;
        }
    }
    redirect_to_home_page("modules/exercise/admin.php?course={$course_code}&exerciseId={$exerciseId}");
}
$tool_content .= action_bar(array(array('title' => $langNewQu, 'url' => "{$_SERVER['SCRIPT_NAME']}?course={$course_code}&amp;exerciseId={$exerciseId}&amp;newQuestion=yes", 'icon' => 'fa-plus-circle', 'level' => 'primary-label', 'button-class' => 'btn-success'), array('title' => $langSelection . ' ' . $langWithCriteria, 'class' => 'randomSelection', 'url' => "#", 'icon' => 'fa-random', 'level' => 'primary-label'), array('title' => $langSelection . ' ' . $langFrom2 . ' ' . $langQuestionPool, 'url' => "question_pool.php?course={$course_code}&amp;fromExercise={$exerciseId}", 'icon' => 'fa-bank', 'level' => 'primary-label')));
if ($nbrQuestions) {
    $questionList = $objExercise->selectQuestionList();
    $i = 1;
    $tool_content .= "\n        <div class='table-responsive'>\n\t    <table class='table-default'>\n\t    <tr>\n\t      <th colspan='2' class='text-left'>{$langQuestionList}</th>\n\t      <th class='text-center'>" . icon('fa-gears', $langActions) . "</th>\n\t    </tr>";
    foreach ($questionList as $id) {
        $objQuestionTmp = new Question();
        $objQuestionTmp->read($id);
开发者ID:kostastzo,项目名称:openeclass,代码行数:31,代码来源:question_list_admin.inc.php

示例9: delete

 private static function delete()
 {
     if (!isset($_POST['deleteQuestion'])) {
         return false;
     }
     global $params;
     extract($data = self::dataDelete($params));
     return Question::delete($_id) == 1;
 }
开发者ID:davidliuliuliu,项目名称:sublite,代码行数:9,代码来源:AdminController.php

示例10: Question

<?php

include '../lib/common.inc.php';
$question = new Question();
$question->id = $_REQUEST['question_id'];
$question->delete();
开发者ID:andreyvit,项目名称:retester,代码行数:6,代码来源:delete-question.php

示例11: Question

 function test_delete()
 {
     //Arrange
     $test_field = "What is their name?";
     $test_description = "What you want to call your character.";
     $test_question = new Question($test_field, $test_description);
     $test_question->save();
     $test_field2 = "What is their profession?";
     $test_description2 = "What you want your character to do.";
     $test_question2 = new Question($test_field2, $test_description2);
     $test_question2->save();
     //Act
     $test_question->delete();
     $result = Question::getAll();
     //Assert
     $this->assertEquals($test_question2, $result[0]);
 }
开发者ID:umamiMike,项目名称:promptr,代码行数:17,代码来源:QuestionTest.php

示例12: setup_module

    // Add empty condition;
    if (@$_POST['create_question']) {
        $question = new Question();
        $question->author_id = $login_uid;
        if (!empty($_POST['body'])) {
            $question->body = $_POST['body'];
            $question->save();
            $message = 'Question has been successfully saved';
        } else {
            $message = 'Fields marked with * must not be left empty';
        }
    }
    if (@$_GET['action'] == 'delete') {
        $question = new Question();
        if (!empty($_GET['content_id'])) {
            $question->delete($_GET['content_id']);
            $message = 'Question has been deleted successfully';
        }
    }
}
/*  ---------- FUNCTION DEFINITION ------------------*/
//call back function
function setup_module($column, $module, $obj)
{
    global $configure_permission, $paging;
    if (!$configure_permission) {
        return 'skip';
    }
    switch ($module) {
        case 'ManageQuestionsModule':
            // $obj->edit = $edit; // this seems to be set nowhere
开发者ID:CivicCommons,项目名称:oldBellCaPA,代码行数:31,代码来源:manage_questions.php

示例13: getDelete

 /**
  * Deletes the question
  **/
 public function getDelete($id)
 {
     //First, let's try to find the question:
     $question = Question::find($id);
     if ($question) {
         //We delete the question directly
         Question::delete();
         //We won't have to think about the tags and the answers, ,
         //because they are set as foreign key and we defined them cascading on deletion,
         //they will be automatically deleted
         //Let's return to the index page with a success message
         return Redirect::route('index')->with('success', 'Question deleted successfully!');
     } else {
         return Redirect::route('index')->with('error', 'Nothing to delete!');
     }
 }
开发者ID:suchayj,项目名称:easymanage,代码行数:19,代码来源:QuestionController.php

示例14: init

 function init()
 {
     $question = new Question();
     $func = array_shift($this->param);
     if (is_numeric($func)) {
         $this->id = $func;
     } else {
         if ($func != '') {
             $_SERVER['REQUEST_METHOD'] = 'POST';
             $course_id = array_shift($this->param);
             Security::checkEditor($course_id);
             switch ($func) {
                 case 'save':
                     $data['course_id'] = $course_id;
                     $data['type_id'] = $_POST['type_id'];
                     $data['data'] = $_POST['data'];
                     $data['count'] = $_POST['count'];
                     $data['answer'] = $_POST['answer'];
                     $id = $_POST['id'];
                     try {
                         $question->update($id, $data);
                     } catch (Exception $e) {
                     }
                     header('Location: /admin_questions/' . $data['course_id']);
                     exit;
                     break;
                 case 'delete':
                     try {
                         $question_id = array_shift($this->param);
                         $question->delete($question_id);
                         echo "ok";
                     } catch (Exception $e) {
                         echo $e;
                     }
                     header('Location: /admin_questions/' . $course_id);
                     exit;
                     break;
                 case 'find':
                     try {
                         $data = array('course_id' => $course_id, 'type_id' => 0, 'data' => '', 'answer' => '');
                         $q_id = $question->add($data);
                         $data['id'] = $q_id;
                         echo json_encode($data);
                     } catch (Exception $e) {
                         echo $e;
                     }
                     exit;
                     break;
                 case 'load':
                     try {
                         $question_id = array_shift($this->param);
                         $data = $question->get(array('course_id' => $course_id, 'id' => $question_id));
                         echo json_encode($data);
                     } catch (Exception $e) {
                         echo $e;
                     }
                     exit;
                     break;
                 default:
             }
         } else {
             header('Location: /404');
             exit;
         }
     }
 }
开发者ID:jedaika,项目名称:Trainings,代码行数:66,代码来源:admin_questions.php


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