protected function afterSubmit(&$response, &$model, &$params, $modifiedAttributes) { $message = \GO\Email\Model\SavedMessage::model()->createFromMimeData($model->content); $response['htmlbody'] = $message->getHtmlBody(); // reset the temp folder created by the core controller // $tmpFolder = new \GO\Base\Fs\Folder(\GO::config()->tmpdir . 'uploadqueue'); // $tmpFolder->delete(); parent::afterSubmit($response, $model, $params, $modifiedAttributes); }
protected function afterSubmit(&$response, &$model, &$params, $modifiedAttributes) { $modelTypeModel = \GO\Base\Model\ModelType::model()->findSingleByAttribute('id', $model->model_type_id); if ($modelTypeModel->model_name == 'GO\\Addressbook\\Model\\Contact') { $modelWithComment = \GO::getModel($modelTypeModel->model_name)->findByPk($model->model_id); $modelWithComment->setAttribute('action_date', \GO\Base\Util\Date::to_unixtime($params['action_date'])); $modelWithComment->save(); } return parent::afterSubmit($response, $model, $params, $modifiedAttributes); }
protected function afterSubmit(&$response, &$model, &$params, $modifiedAttributes) { $stmt = \GO\Addressbook\Model\Addresslist::model()->find(\GO\Base\Db\FindParams::newInstance()->permissionLevel(\GO\Base\Model\Acl::WRITE_PERMISSION)); while ($addresslist = $stmt->fetch()) { $linkModel = $addresslist->hasManyMany('contacts', $model->id); $mustHaveLinkModel = isset($params['addresslist_' . $addresslist->id]); if ($linkModel && !$mustHaveLinkModel) { $linkModel->delete(); } if (!$linkModel && $mustHaveLinkModel) { $addresslist->addManyMany('contacts', $model->id); } } if (!empty($params['delete_photo'])) { $model->removePhoto(); $model->save(); } if (isset($_FILES['image']['tmp_name'][0]) && is_uploaded_file($_FILES['image']['tmp_name'][0])) { $destinationFile = new \GO\Base\Fs\File(\GO::config()->getTempFolder()->path() . '/' . $_FILES['image']['name'][0]); move_uploaded_file($_FILES['image']['tmp_name'][0], $destinationFile->path()); $model->setPhoto($destinationFile); $model->save(); $response['photo_url'] = $model->photoThumbURL; $response['original_photo_url'] = $model->photoURL; } elseif (!empty($params['download_photo_url'])) { $file = \GO\Base\Fs\File::tempFile(); $c = new \GO\Base\Util\HttpClient(); if (!$c->downloadFile($params['download_photo_url'], $file)) { throw new \Exception("Could not download photo from: '" . $params['download_photo_url'] . "'"); } $model->setPhoto($file); $model->save(); $response['photo_url'] = $model->photoThumbURL; $response['original_photo_url'] = $model->photoURL; } return parent::afterSubmit($response, $model, $params, $modifiedAttributes); }
protected function afterSubmit(&$response, &$model, &$params, $modifiedAttributes) { if (!empty($params['comment']) && \GO::modules()->comments) { $comment = new \GO\Comments\Model\Comment(); // $comment->id $comment->model_id = $model->id; $comment->model_type_id = $model->modelTypeId(); $comment->user_id = \GO::user()->id; // $comment->ctime // $comment->mtime $comment->comments = $params['comment']; $comment->save(); } if (\GO::modules()->files) { $f = new \GO\Files\Controller\FolderController(); $f->processAttachments($response, $model, $params); } return parent::afterSubmit($response, $model, $params, $modifiedAttributes); }
protected function afterSubmit(&$response, &$model, &$params, $modifiedAttributes) { if (empty($params['id'])) { $model->addAlias($params['email'], $params['name']); } else { $alias = $model->getDefaultAlias(); $alias->name = $params['name']; if (isset($params['email'])) { $alias->email = $params['email']; } $alias->signature = $params['signature']; $alias->save(); } if (\GO::modules()->addressbook && isset($params['default_account_template_id'])) { if ($params['default_account_template_id'] == -1 || empty($params['default_account_template_id'])) { $defaultTemplateModel = \GO\Addressbook\Model\DefaultTemplateForAccount::model()->findByPk($model->id); if ($defaultTemplateModel) { $defaultTemplateModel->delete(); } } elseif ($params['default_account_template_id'] > 0) { $defaultTemplateModel = \GO\Addressbook\Model\DefaultTemplateForAccount::model()->findByPk($model->id); if (!$defaultTemplateModel) { $defaultTemplateModel = new \GO\Addressbook\Model\DefaultTemplateForAccount(); $defaultTemplateModel->account_id = $model->id; } $defaultTemplateModel->template_id = $params['default_account_template_id']; $defaultTemplateModel->save(); } } return parent::afterSubmit($response, $model, $params, $modifiedAttributes); }
protected function afterSubmit(&$response, &$model, &$params, $modifiedAttributes) { //output the new path of the file if we changed the name. if (isset($modifiedAttributes['name'])) { $response['new_path'] = $model->path; } $notifyRecursive = !empty($params['notifyRecursive']) && $params['notifyRecursive'] == 'true' ? true : false; if (isset($params['notify'])) { if ($params['notify'] == 1) { $model->addNotifyUser(\GO::user()->id, $notifyRecursive); } if ($params['notify'] == 0) { $model->removeNotifyUser(\GO::user()->id, $notifyRecursive); } } parent::afterSubmit($response, $model, $params, $modifiedAttributes); }
protected function afterSubmit(&$response, &$model, &$params, $modifiedAttributes) { // if(isset($_FILES['files']['tmp_name'][0])) // $response = array_merge($response,$this->run("upload",$params,false)); return parent::afterSubmit($response, $model, $params, $modifiedAttributes); }
protected function afterSubmit(&$response, &$model, &$params, $modifiedAttributes) { $isNewEvent = empty($params['id']); if (!$model->isResource()) { $this->_saveParticipants($params, $model, $response); $this->_saveResources($params, $model, $isNewEvent, $modifiedAttributes); } if (\GO::modules()->files) { //handle attachment when event is saved from an email. $f = new \GO\Files\Controller\FolderController(); $f->processAttachments($response, $model, $params); } // Send the status and status background color with the response $response['status_color'] = $model->getStatusColor(); $response['status'] = $model->status; $response['is_organizer'] = $model->is_organizer ? true : false; $response['background'] = $model->background; if ($model->is_organizer) { //$model->sendMeetingRequest(); if ($model->hasOtherParticipants()) { $response['isNewEvent'] = $isNewEvent; if ($isNewEvent) { $response['askForMeetingRequest'] = true; $response['is_update'] = false; } else { //only ask to send email if a relevant attribute has been altered $attr = $model->getRelevantMeetingAttributes(); foreach ($modifiedAttributes as $key => $value) { if (in_array($key, $attr)) { $response['askForMeetingRequest'] = true; $response['is_update'] = true; break; } } } } } $allParticipantsStmt = \GO\Calendar\Model\Participant::model()->findByAttributes(array('event_id' => $model->id, 'is_organizer' => 0)); $allParticipantIds = array(); foreach ($allParticipantsStmt as $participantModel) { $allParticipantIds[] = $participantModel->user_id; } $newParticipantIds = !empty(\GO::session()->values['new_participant_ids']) ? \GO::session()->values['new_participant_ids'] : array(); $oldParticipantsIds = array_diff($allParticipantIds, $newParticipantIds); if (!empty($newParticipantIds) && !empty($oldParticipantsIds)) { $response['askForMeetingRequestForNewParticipants'] = true; } return parent::afterSubmit($response, $model, $params, $modifiedAttributes); }