本文整理汇总了PHP中Versions::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Versions::save方法的具体用法?PHP Versions::save怎么用?PHP Versions::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Versions
的用法示例。
在下文中一共展示了Versions::save方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addsubmitAction
function addsubmitAction()
{
if ($this->request->isPost()) {
$date = $this->request->getPost('date');
$system_id = $this->request->getPost('system_id');
$version = $this->request->getPost('version');
# print_r($this->request->getPost());exit();
$versions = new Versions();
$versions->date = $date;
$versions->version = $version;
$versions->system_id = $system_id;
$versions->created_by = 105;
$versions->created_at = date('Y-m-d');
if ($versions->save() == false) {
foreach ($versions->getMessages() as $message) {
$this->flash->error((string) $message);
}
} else {
$this->flash->success('Create version success');
$this->response->redirect('versions/system/' . $system_id);
}
}
}
示例2: defined
*
* Add the option 'edit_as_thread' to activate this script in some article.
*
* @author Bernard Paques
* @reference
* @license http://www.gnu.org/copyleft/lesser.txt GNU Lesser General Public License
*/
// loaded from articles/view.php
defined('YACS') or exit('Script must be included');
// process uploaded data
if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'POST') {
// update an existing page
if (isset($_REQUEST['id'])) {
// remember the previous version
if ($item['id'] && Versions::are_different($item, $_REQUEST)) {
Versions::save($item, 'article:' . $item['id']);
}
// stop on error
if (!Articles::put_attributes($_REQUEST) || is_object($overlay) && !$overlay->remember('update', $_REQUEST, 'article:' . $_REQUEST['id'])) {
$item = $_REQUEST;
$with_form = TRUE;
// else display the updated page
} else {
// do whatever is necessary on page update
Articles::finalize_update($anchor, $_REQUEST, $overlay, isset($_REQUEST['silent']) && $_REQUEST['silent'] == 'Y', isset($_REQUEST['notify_watchers']) && $_REQUEST['notify_watchers'] == 'Y', isset($_REQUEST['notify_followers']) && $_REQUEST['notify_followers'] == 'Y');
// cascade changes on access rights
if ($_REQUEST['active'] != $item['active']) {
Anchors::cascade('article:' . $item['id'], $_REQUEST['active']);
}
// the page has been modified
$context['text'] .= '<p>' . i18n::s('The page has been successfully updated.') . '</p>';
示例3: elseif
// follow-up commands
$context['text'] .= Skin::build_block(Skin::build_link($anchor->get_url('files'), i18n::s('Done'), 'button'), 'bottom');
// extension is not allowed
} elseif (Files::get_uploaded('upload', 'name') && !Files::is_authorized(Files::get_uploaded('upload', 'name'))) {
Safe::header('Status: 401 Unauthorized', TRUE, 401);
Logger::error(i18n::s('This type of file is not allowed.'));
// an error occured
} elseif (count($context['error'])) {
$item = $_REQUEST;
$with_form = TRUE;
// process uploaded data
} elseif (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'POST') {
// remember the previous version
if (isset($item['id'])) {
include_once '../versions/versions.php';
Versions::save($item, 'file:' . $item['id']);
}
// assume this is just an update of the record
$action = 'file:update';
// true when several files are uploaded at once
$exploded = FALSE;
// this record is a reference to an external file -- do not take upload into account, if any
if (isset($_REQUEST['file_href']) && $_REQUEST['file_href']) {
// protect from hackers -- encode_link() would introduce &
$_REQUEST['file_href'] = trim(preg_replace(FORBIDDEN_IN_URLS, '_', $_REQUEST['file_href']), ' _');
// ensure we have a title
if (!$_REQUEST['title']) {
$_REQUEST['title'] = str_replace('%20', ' ', basename($_REQUEST['file_href']));
}
// ensure we have a file name
$_REQUEST['file_name'] = utf8::to_ascii(str_replace('%20', ' ', basename($_REQUEST['file_href'])));
示例4: executeXlsTasksImport
public function executeXlsTasksImport(sfWebRequest $request)
{
app::setPageTitle('Import Spreadsheet', $this->getResponse());
if ($request->isMethod(sfRequest::PUT)) {
if ($request->hasParameter('import_file')) {
if (is_file($import_spreadsheet_file = sfConfig::get('sf_upload_dir') . '/' . $request->getParameter('import_file'))) {
$import_fields = $this->getUser()->getAttribute('import_fields');
$data = new Spreadsheet_Excel_Reader($import_spreadsheet_file);
$projects_id = $request->getParameter('projects_id');
if ($request->getParameter('import_first_row') == 1) {
$first_row = 1;
} elseif ($data->rowcount() > 2) {
$first_row = 2;
} else {
$first_row = 1;
}
for ($i = $first_row; $i <= $data->rowcount(); $i++) {
$t = new Tasks();
$t->setCreatedBy($this->getUser()->getAttribute('id'))->setCreatedAt(date('Y-m-d H:i:s'))->setProjectsId($request->getParameter('projects_id'));
$extra_fields = array();
for ($j = 1; $j <= $data->colcount(); $j++) {
if (isset($import_fields[$j])) {
$v = $data->val($i, $j);
if (strlen(trim($v)) == 0) {
continue;
}
switch ($import_fields[$j]) {
case 'TasksGroups':
if ($id = app::getProjectCfgItemIdByName($v, 'TasksGroups', $projects_id)) {
$t->setTasksGroupsId($id);
} else {
$cfg = new TasksGroups();
$cfg->setName($v);
$cfg->setProjectsId($projects_id);
$cfg->save();
$t->setTasksGroupsId($cfg->getId());
}
break;
case 'Versions':
if ($id = app::getProjectCfgItemIdByName($v, 'Versions', $projects_id)) {
$t->setVersionsId($id);
} else {
$cfg = new Versions();
$cfg->setName($v);
$cfg->setProjectsId($projects_id);
$cfg->save();
$t->setVersionsId($cfg->getId());
}
break;
case 'ProjectsPhases':
if ($id = app::getProjectCfgItemIdByName($v, 'ProjectsPhases', $projects_id)) {
$t->setProjectsPhasesId($id);
} else {
$cfg = new ProjectsPhases();
$cfg->setName($v);
$cfg->setProjectsId($projects_id);
$cfg->save();
$t->setProjectsPhasesId($cfg->getId());
}
break;
case 'TasksPriority':
if ($id = app::getCfgItemIdByName($v, 'TasksPriority')) {
$t->setTasksPriorityId($id);
} else {
$cfg = new TasksPriority();
$cfg->setName($v);
$cfg->save();
$t->setTasksPriorityId($cfg->getId());
}
break;
case 'TasksLabels':
if ($id = app::getCfgItemIdByName($v, 'TasksLabels')) {
$t->setTasksLabelId($id);
} else {
$cfg = new TasksLabels();
$cfg->setName($v);
$cfg->save();
$t->setTasksLabelId($cfg->getId());
}
break;
case 'name':
$t->setName($v);
break;
case 'TasksStatus':
if ($id = app::getCfgItemIdByName($v, 'TasksStatus')) {
$t->setTasksStatusId($id);
} else {
$cfg = new TasksStatus();
$cfg->setName($v);
$cfg->save();
$t->setTasksStatusId($cfg->getId());
}
break;
case 'TasksTypes':
if ($id = app::getCfgItemIdByName($v, 'TasksTypes')) {
$t->setTasksTypeId($id);
} else {
$cfg = new TasksTypes();
$cfg->setName($v);
$cfg->save();
//.........这里部分代码省略.........