本文整理汇总了PHP中Survey::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Survey::save方法的具体用法?PHP Survey::save怎么用?PHP Survey::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Survey
的用法示例。
在下文中一共展示了Survey::save方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fire
/**
* Execute the console command.
*
* @return mixed
*/
public function fire()
{
$survey = new Survey();
$survey->name = 'ibSurvey';
$survey->school_id = 1;
$survey->save();
}
示例2: create
public static function create($name, $userID)
{
$survey = new Survey();
$survey->name = $name;
$survey->ownerID = $userID;
$survey->save();
$user = $survey->owner();
$user->addSurvey($survey->id);
return $survey->id;
}
示例3: addSurvey
/**
*
*/
public function addSurvey()
{
if ($_POST) {
$input = Input::all();
// Save the survey
$rules = array('name' => 'required');
$validator = Validator::make($input, $rules);
$survey = new Survey();
$survey->name = $input['name'];
if (isset($input['description'])) {
$survey->description = $input['description'];
}
$survey->save();
return Redirect::to('surveys');
}
$this->layout->content = View::make('survey.add');
}
示例4: createSurvey
public function createSurvey()
{
$this->validateSubtopicContent();
$name = trim($this->data->name);
if (empty($name)) {
throw new \InvalidArgumentException("Debes enviar un nombre valido para la encuesta, debe contener entre 2 y 80 caracteres");
}
$survey = new \Survey();
$survey->idAccount = 1;
$survey->wizardOption = "draft";
$survey->name = $name;
$survey->idSubtopicContent = $this->data->subtopicContent;
if (!$survey->save()) {
foreach ($survey->getMessages() as $msg) {
$this->logger->log("Error while saving survey draft: {$msg}");
}
throw new \InvalidArgumentException("Ocurrió un error mientras se guardaba la encuenta: {$msg}}");
}
}
示例5: put
public function put($id)
{
if (!isset($this->put['name'])) {
$this->message = "Missing one or more required parameters";
$this->status = 400;
return;
}
$survey = new Survey($id);
if (!$survey->exists()) {
$this->message = "Survey not found";
$this->status = 404;
return;
}
if ($survey->ownerID != Session::$user['id']) {
$this->message = "Unauthorized";
$this->status = 403;
return;
}
$survey->name = $this->put['name'];
$survey->save();
$this->response[$this->slug][] = $survey->apiData();
}
示例6: actionOrdinaryCreate
public function actionOrdinaryCreate()
{
$model = new Survey();
//for the show
$model->user_id = 1;
//= $this->loadUser(1);
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
//todo 提交前要对用户是否已有记录做check,如果已有记录。则更新
if (isset($_POST['Survey'])) {
$model->attributes = $_POST['Survey'];
// delete or get old_id
if ($model->save()) {
// $this->redirect(array('view','id'=>$model->id));
$this->redirect(array('reginfo/attending'));
}
}
$this->render('ordinaryCreate', array('model' => $model));
}
示例7: survey_post_gAction
/**
* @Post('/Survey/{id:[0-9]+}')
*/
public function survey_post_gAction($id)
{
$ans = [];
try {
$validation = new SurveyValidation();
$messages = $validation->validate($_POST);
if (count($messages)) {
foreach ($messages as $message) {
throw new Exception($message, 102);
}
}
$item_id = $this->request->getPost('item_id');
$value = $this->request->getPost('value');
$new_record = new Survey();
$new_record->item = $item_id;
$new_record->user_id = $id;
$new_record->value = $value;
$new_record->date = date("y-m-d H:i:s", time());
$succeed = $new_record->save();
if ($succeed) {
$ans['ret'] = 0;
} else {
foreach ($new_record->getMessages() as $message) {
throw new Exception($message, 100);
}
}
} catch (Exception $e) {
$ans['ret'] = -1;
Utils::makeError($e, $ans);
} finally {
echo json_encode($ans);
}
}
示例8: store
public static function store()
{
if (!self::check_logged_in()) {
Redirect::to('/login', array('error' => 'You must log in to access this resource.'));
return;
}
$params = $_POST;
$user = self::get_user_logged_in();
$attributes = array('person' => $user->id, 'description' => $params['description'], 'type' => $params['type']);
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->save();
Redirect::to('/survey/' . $survey->id, array('message' => 'Survey successfully added!'));
} else {
View::make('survey/new.html', array('errors' => $errors, 'attributes' => $attributes));
}
}
示例9: showEditSettingsLayoutRes
function showEditSettingsLayoutRes()
{
$displaySysAdmin = new DisplaySysAdmin();
$_SESSION['EDITSURVEY'] = 1;
$survey = new Survey($_SESSION['SUID']);
$survey->setPageHeader(loadvarAllowHTML(SETTING_PAGE_HEADER));
$survey->setPageFooter(loadvarAllowHTML(SETTING_PAGE_FOOTER));
$survey->setQuestionAlignment(loadvar(SETTING_QUESTION_ALIGNMENT));
$ans = loadvar(SETTING_QUESTION_FORMATTING);
if (!is_array($ans)) {
$ans = array($ans);
}
$survey->setQuestionFormatting(implode("~", $ans));
$survey->setAnswerAlignment(loadvar(SETTING_ANSWER_ALIGNMENT));
$ans = loadvar(SETTING_ANSWER_FORMATTING);
if (!is_array($ans)) {
$ans = array($ans);
}
$survey->setAnswerFormatting(implode("~", $ans));
$survey->setButtonAlignment(loadvar(SETTING_BUTTON_ALIGNMENT));
$ans = loadvar(SETTING_BUTTON_FORMATTING);
if (!is_array($ans)) {
$ans = array($ans);
}
$survey->setButtonFormatting(implode("~", $ans));
$survey->setShowBackButton(loadvar(SETTING_BACK_BUTTON));
$survey->setShowNextButton(loadvar(SETTING_NEXT_BUTTON));
$survey->setShowDKButton(loadvar(SETTING_DK_BUTTON));
$survey->setShowRFButton(loadvar(SETTING_RF_BUTTON));
$survey->setShowUpdateButton(loadvar(SETTING_UPDATE_BUTTON));
$survey->setShowNAButton(loadvar(SETTING_NA_BUTTON));
$survey->setShowRemarkButton(loadvar(SETTING_REMARK_BUTTON));
$survey->setShowCloseButton(loadvar(SETTING_CLOSE_BUTTON));
$survey->setShowRemarkSaveButton(loadvar(SETTING_REMARK_SAVE_BUTTON));
$survey->setLabelBackButton(loadvarAllowHTML(SETTING_BACK_BUTTON_LABEL));
$survey->setLabelNextButton(loadvarAllowHTML(SETTING_NEXT_BUTTON_LABEL));
$survey->setLabelDKButton(loadvarAllowHTML(SETTING_DK_BUTTON_LABEL));
$survey->setLabelRFButton(loadvarAllowHTML(SETTING_RF_BUTTON_LABEL));
$survey->setLabelUpdateButton(loadvarAllowHTML(SETTING_UPDATE_BUTTON_LABEL));
$survey->setLabelNAButton(loadvarAllowHTML(SETTING_NA_BUTTON_LABEL));
$survey->setLabelRemarkButton(loadvarAllowHTML(SETTING_REMARK_BUTTON_LABEL));
$survey->setLabelCloseButton(loadvarAllowHTML(SETTING_CLOSE_BUTTON_LABEL));
$survey->setLabelRemarkSaveButton(loadvarAllowHTML(SETTING_REMARK_SAVE_BUTTON_LABEL));
$survey->setShowProgressBar(loadvar(SETTING_PROGRESSBAR_SHOW));
$survey->setProgressBarType(loadvar(SETTING_PROGRESSBAR_TYPE));
$survey->setProgressBarFillColor(loadvar(SETTING_PROGRESSBAR_FILLED_COLOR));
$survey->setProgressBarWidth(loadvar(SETTING_PROGRESSBAR_WIDTH));
$survey->setTemplate(loadvar(SETTING_SURVEY_TEMPLATE));
$survey->setErrorPlacement(loadvar(SETTING_ERROR_PLACEMENT));
$survey->setHeaderAlignment(loadvar(SETTING_HEADER_ALIGNMENT));
$ans = loadvar(SETTING_HEADER_FORMATTING);
if (!is_array($ans)) {
$ans = array($ans);
}
$survey->setTableWidth(loadvar(SETTING_TABLE_WIDTH));
$survey->setQuestionColumnWidth(loadvar(SETTING_QUESTION_COLUMN_WIDTH));
$survey->setHeaderFormatting(implode("~", $ans));
$survey->setHeaderFixed(loadvar(SETTING_HEADER_FIXED));
$survey->setHeaderScrollDisplay(loadvar(SETTING_HEADER_SCROLL_DISPLAY));
$survey->setTableBordered(loadvar(SETTING_GROUP_TABLE_BORDERED));
$survey->setTableCondensed(loadvar(SETTING_GROUP_TABLE_CONDENSED));
$survey->setTableHovered(loadvar(SETTING_GROUP_TABLE_HOVERED));
$survey->setTableStriped(loadvar(SETTING_GROUP_TABLE_STRIPED));
$survey->setTableMobile(loadvar(SETTING_TABLE_MOBILE));
$survey->setTableMobileLabels(loadvar(SETTING_TABLE_MOBILE_LABELS));
$survey->setEnumeratedDisplay(loadvar(SETTING_ENUMERATED_ORIENTATION));
$survey->setEnumeratedBordered(loadvar(SETTING_ENUMERATED_BORDERED));
$survey->setEnumeratedSplit(loadvar(SETTING_ENUMERATED_SPLIT));
$survey->setEnumeratedTextbox(loadvar(SETTING_ENUMERATED_TEXTBOX));
$survey->setEnumeratedTextboxLabel(loadvar(SETTING_ENUMERATED_TEXTBOX_LABEL));
$survey->setEnumeratedLabel(loadvar(SETTING_ENUMERATED_LABEL));
$survey->setHeaderAlignment(loadvar(SETTING_HEADER_ALIGNMENT));
$ans = loadvar(SETTING_HEADER_FORMATTING);
if (!is_array($ans)) {
$ans = array($ans);
}
$survey->setHeaderFormatting(implode("~", $ans));
$survey->setEnumeratedOrder(loadvar(SETTING_ENUMERATED_ORDER));
$survey->setSliderOrientation(loadvar(SETTING_SLIDER_ORIENTATION));
$survey->setIncrement(loadvar(SETTING_SLIDER_INCREMENT));
$survey->setTooltip(loadvar(SETTING_SLIDER_TOOLTIP));
$survey->setTextbox(loadvar(SETTING_SLIDER_TEXTBOX));
$survey->setTextboxLabel(loadvar(SETTING_SLIDER_TEXTBOX_LABEL));
$survey->setSliderLabelPlacement(loadvar(SETTING_SLIDER_LABEL_PLACEMENT));
$survey->setShowSectionHeader(loadvar(SETTING_SHOW_SECTION_HEADER));
$survey->setShowSectionFooter(loadvar(SETTING_SHOW_SECTION_FOOTER));
$survey->save();
$compiler = new Compiler($_SESSION['SUID'], getSurveyVersion($survey));
$mess = $compiler->generateGetFillsSurvey();
$mess = $compiler->generateInlineFieldsSurvey();
$content = $displaySysAdmin->displaySuccess(Language::messageDisplaySettingsChanged());
/* update last page */
$_SESSION['LASTPAGE'] = substr($_SESSION['LASTPAGE'], 0, strripos($_SESSION['LASTPAGE'], "res"));
return $displaySysAdmin->showEditSettingsLayout($content);
}
示例10: showTranslateSettingsLayoutRes
function showTranslateSettingsLayoutRes()
{
$displayTranslator = new DisplayTranslator();
$_SESSION['EDITSURVEY'] = 1;
$survey = new Survey($_SESSION['SUID']);
$survey->setLabelBackButton(loadvarAllowHTML(SETTING_BACK_BUTTON_LABEL));
$survey->setLabelNextButton(loadvarAllowHTML(SETTING_NEXT_BUTTON_LABEL));
$survey->setLabelDKButton(loadvarAllowHTML(SETTING_DK_BUTTON_LABEL));
$survey->setLabelRFButton(loadvarAllowHTML(SETTING_RF_BUTTON_LABEL));
$survey->setLabelUpdateButton(loadvarAllowHTML(SETTING_UPDATE_BUTTON_LABEL));
$survey->setLabelNAButton(loadvarAllowHTML(SETTING_NA_BUTTON_LABEL));
$survey->setLabelRemarkButton(loadvarAllowHTML(SETTING_REMARK_BUTTON_LABEL));
$survey->setLabelCloseButton(loadvarAllowHTML(SETTING_CLOSE_BUTTON_LABEL));
$survey->setLabelRemarkSaveButton(loadvarAllowHTML(SETTING_REMARK_SAVE_BUTTON_LABEL));
$survey->setEnumeratedTextboxLabel(loadvar(SETTING_ENUMERATED_TEXTBOX_LABEL));
$survey->save();
$content = $displayTranslator->displaySuccess(Language::messageDisplayTextsChanged());
/* update last page */
$_SESSION['LASTPAGE'] = substr($_SESSION['LASTPAGE'], 0, strripos($_SESSION['LASTPAGE'], "res"));
return $displayTranslator->showTranslateSettingsLayout($content);
}