本文整理汇总了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));
}
}
示例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);
}
示例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? */