本文整理汇总了PHP中Attachments::insertAttachments方法的典型用法代码示例。如果您正苦于以下问题:PHP Attachments::insertAttachments方法的具体用法?PHP Attachments::insertAttachments怎么用?PHP Attachments::insertAttachments使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Attachments
的用法示例。
在下文中一共展示了Attachments::insertAttachments方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processForm
protected function processForm(sfWebRequest $request, sfForm $form)
{
$form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
if ($form->isValid()) {
if ($form->getObject()->isNew()) {
$tasks = Doctrine_Core::getTable('Tasks')->find($request->getParameter('tasks_id'));
if ($form->getValue('tasks_priority_id') > 0) {
$tasks->setTasksPriorityId($form->getValue('tasks_priority_id'));
} else {
unset($form['tasks_priority_id']);
}
if ($request->getParameter('tasks_labels_id') > 0) {
$tasks->setTasksLabelId($request->getParameter('tasks_labels_id'));
}
if ($request->getParameter('tasks_types_id') > 0) {
$tasks->setTasksTypeId($request->getParameter('tasks_types_id'));
}
if (strlen($form->getValue('due_date')) > 0) {
$tasks->setDueDate($form->getValue('due_date'));
} else {
unset($form['due_date']);
}
if ($request->getParameter('progress') > 0) {
$tasks->setProgress($request->getParameter('progress'));
}
if ($form->getValue('tasks_status_id') > 0) {
$tasks->setTasksStatusId($form->getValue('tasks_status_id'));
if (in_array($form->getValue('tasks_status_id'), app::getStatusByGroup('closed', 'TasksStatus'))) {
$tasks->setClosedDate(date('Y-m-d H:i:s'));
$tasks->save();
}
if (!in_array($form->getValue('tasks_status_id'), app::getStatusByGroup('closed', 'TasksStatus'))) {
$tasks->setClosedDate(null);
$tasks->save();
}
} else {
unset($form['tasks_status_id']);
}
$tasks->save();
}
if ($form->getObject()->isNew() and sfConfig::get('app_allow_adit_tasks_comments_date') != 'on') {
$form->setFieldValue('created_at', date('Y-m-d H:i:s'));
}
$tasks_comments = $form->save();
Attachments::insertAttachments($request->getFiles(), 'comments', $tasks_comments->getId(), $request->getParameter('attachments_info'), $this->getUser());
TasksComments::sendNotification($this, $tasks_comments, $this->getUser());
$this->redirect('tasksComments/index?projects_id=' . $request->getParameter('projects_id') . '&tasks_id=' . $request->getParameter('tasks_id'));
}
}
示例2: processForm
protected function processForm(sfWebRequest $request, sfForm $form)
{
$form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
if ($form->isValid()) {
if ($form->getObject()->isNew()) {
$project = Doctrine_Core::getTable('Projects')->find($request->getParameter('projects_id'));
if ($request->getParameter('projects_types_id') > 0) {
$project->setProjectsTypesId($request->getParameter('projects_types_id'));
}
if ($request->getParameter('projects_status_id') > 0) {
$project->setProjectsStatusId($request->getParameter('projects_status_id'));
}
$project->save();
}
if ($form->getObject()->isNew()) {
$form->setFieldValue('created_at', date('Y-m-d H:i:s'));
}
$projects_comments = $form->save();
Attachments::insertAttachments($request->getFiles(), 'projectsComments', $projects_comments->getId(), $request->getParameter('attachments_info'), $this->getUser());
ProjectsComments::sendNotification($this, $projects_comments, $this->getUser());
$this->redirect('projectsComments/index?projects_id=' . $projects_comments->getProjectsId());
}
}
示例3: processForm
protected function processForm(sfWebRequest $request, sfForm $form)
{
$form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
if ($form->isValid()) {
$form->setFieldValue('assigned_to', implode(',', $form['assigned_to']->getValue()));
$send_to = $this->getSendTo($form);
if ($form->getObject()->isNew()) {
$previeous_status = false;
} else {
$previeous_status = $form->getObject()->getDiscussionsStatusId();
}
if ($form->getObject()->isNew()) {
$form->setFieldValue('created_at', date('Y-m-d H:i:s'));
}
$discussions = $form->save();
ExtraFieldsList::setValues($request->getParameter('extra_fields'), $discussions->getId(), 'discussions', $this->getUser(), $request);
Attachments::insertAttachments($request->getFiles(), 'discussions', $discussions->getId(), $request->getParameter('attachments_info'), $this->getUser());
$discussions = $this->addCommentIfStatusChanged($previeous_status, $discussions);
$discussions = $this->checkIfAssignedToChanged($send_to, $discussions);
$this->addRelatedItems($discussions, $request);
Discussions::sendNotification($this, $discussions, $send_to, $this->getUser());
$this->redirect_to($request->getParameter('redirect_to'), $discussions->getProjectsId(), $discussions->getId(), $request);
}
}
示例4: processForm
protected function processForm(sfWebRequest $request, sfForm $form)
{
$form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
if ($form->isValid()) {
if ($form->getObject()->isNew()) {
$previeous_status = false;
} else {
$previeous_status = $form->getObject()->getTicketsStatusId();
}
if ($form->getObject()->isNew()) {
$previeous_departmnet = false;
} else {
$previeous_departmnet = $form->getObject()->getDepartmentsId();
}
$send_to = $this->getSendTo($form);
if ($form->getObject()->isNew()) {
$form->setFieldValue('created_at', date('Y-m-d H:i:s'));
}
$tickets = $form->save();
ExtraFieldsList::setValues($request->getParameter('extra_fields'), $tickets->getId(), 'tickets', $this->getUser(), $request);
Attachments::insertAttachments($request->getFiles(), 'tickets', $tickets->getId(), $request->getParameter('attachments_info'), $this->getUser());
$tickets = $this->addCommentIfStatusChanged($previeous_status, $previeous_departmnet, $tickets);
$this->addRelatedItems($tickets, $request);
if ($tickets->getUsersId() > 0) {
Tickets::sendNotification($this, $tickets, $send_to, $this->getUser(), $request->getParameter('extra_notification', array()));
}
$this->redirect_to($request->getParameter('redirect_to'), $tickets->getProjectsId(), $tickets->getId(), $request);
}
}
示例5: processForm
protected function processForm(sfWebRequest $request, sfForm $form)
{
$form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
if ($form->isValid()) {
$events = $form->save();
ExtraFieldsList::setValues($request->getParameter('extra_fields'), $events->getEventId(), 'events', $this->getUser());
Attachments::insertAttachments($request->getFiles(), 'events', $events->getEventId(), $request->getParameter('attachments_info'), $this->getUser());
if ($events->getUsersId() > 0) {
$this->redirect('scheduler/personal');
} else {
$this->redirect('scheduler/index');
}
}
}