public static function ajaxEditTemplate($data, $func) { if (!current_user_can('wpProQuiz_edit_quiz')) { return json_encode(array()); } $templateMapper = new WpProQuiz_Model_TemplateMapper(); $template = new WpProQuiz_Model_Template($data); $templateMapper->updateName($template->getTemplateId(), $template->getName()); return json_encode(array()); }
/** * @param WpProQuiz_Model_Template $template * @return WpProQuiz_Model_Template */ public function save($template) { $this->_wpdb->replace($this->_tableTemplate, array('template_id' => $template->getTemplateId(), 'name' => $template->getName(), 'type' => $template->getType(), 'data' => @serialize($template->getData())), array('%d', '%s', '%d', '%s')); $template->setTemplateId($this->getInsertId()); return $template; }