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


PHP Survey::update方法代码示例

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


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

示例1: update

 public static function update($id)
 {
     if (!self::check_logged_in()) {
         Redirect::to('/login', array('error' => 'You must log in to access this resource.'));
         return;
     }
     $params = $_POST;
     $oldsurvey = Survey::find($id);
     $user = self::get_user_logged_in();
     $attributes = array('person' => $user->id, 'id' => $id, 'description' => $params['description'], 'type' => $oldsurvey->type);
     if ($attributes['type'] == 'int-value') {
         if ($params['min_value']) {
             if (is_numeric($params['min_value'])) {
                 $attributes['min_value'] = $params['min_value'];
             }
         }
         if ($params['max_value']) {
             if (is_numeric($params['max_value'])) {
                 $attributes['max_value'] = $params['max_value'];
             }
         }
     }
     $survey = new Survey($attributes);
     $errors = $survey->errors();
     if (count($errors) == 0) {
         $survey->update();
         Redirect::to('/survey/' . $survey->id, array('message' => 'Survey successfully updated!'));
     } else {
         Redirect::to('/survey/' . $survey->id . '/edit', array('errors' => $errors, 'attributes' => $attributes));
     }
 }
开发者ID:banjohirvi,项目名称:Tsoha-Bootstrap,代码行数:31,代码来源:survey_controller.php

示例2: array

 function count_item($i)
 {
     $field = array('selected');
     $m = new Survey();
     $m->clear();
     $m->setField($field);
     $m->setTable('vcb_survey_item');
     $m->setWhere('id', '=', $i);
     $data = $m->select();
     $add = $data[0]['selected'] + 1;
     $field1 = array('selected' => $add);
     $m1 = new Survey();
     $m1->clear();
     $m1->setField($field1);
     $m1->setTable('vcb_survey_item');
     $m1->setWhere('id', '=', $i);
     $data_l = $m1->update();
     //var_dump($data_l);
 }
开发者ID:koery,项目名称:Vcanbuy,代码行数:19,代码来源:SurveyController.class.php

示例3: getStringFromRequest

if (!session_loggedin() || !user_ismember($group_id, 'A')) {
    echo "<h1>" . _('Permission denied') . "</h1>";
    $sh->footer(array());
    exit;
}
if (getStringFromRequest('post') == "Y") {
    if (!form_key_is_valid(getStringFromRequest('form_key'))) {
        exit_form_double_submit();
    }
    $survey_title = getStringFromRequest('survey_title');
    $to_add = getStringFromRequest('to_add');
    $to_del = getStringFromRequest('to_del');
    $is_active = getStringFromRequest('is_active');
    if ($survey_id) {
        /* Modify */
        $s->update($survey_title, $to_add, $to_del, $is_active);
        $feedback = _('UPDATE SUCCESSFUL');
    } else {
        /* Add */
        $s->create($survey_title, $to_add, $is_active);
        $feedback = _('Survey Inserted');
    }
}
/* Order changes */
if (getStringFromRequest('updown') == "Y") {
    $question_id = getIntFromRequest('question_id');
    $is_up = getStringFromRequest('is_up');
    $s->updateOrder($question_id, $is_up);
    $feedback = _('UPDATE SUCCESSFUL');
}
/* Error on previous transactions? */
开发者ID:neymanna,项目名称:fusionforge,代码行数:31,代码来源:survey.php


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