protected function hook_postStore() { $q = $this->_getQuery(); //split out related departments and store them seperatly. $q->setDelete('project_departments'); $q->addWhere('project_id=' . (int) $this->project_id); $q->exec(); $q->clear(); $stored_departments = array(); if ($this->project_departments) { foreach ($this->project_departments as $department) { if ($department) { $q->addTable('project_departments'); $q->addInsert('project_id', $this->project_id); $q->addInsert('department_id', $department); $stored_departments[$department] = $this->project_id; $q->exec(); $q->clear(); } } } $this->stored_departments = $stored_departments; //split out related contacts and store them seperatly. $q->setDelete('project_contacts'); $q->addWhere('project_id=' . (int) $this->project_id); $q->exec(); $q->clear(); $stored_contacts = array(); if ($this->project_contacts) { foreach ($this->project_contacts as $contact) { if ($contact) { $q->addTable('project_contacts'); $q->addInsert('project_id', $this->project_id); $q->addInsert('contact_id', $contact); $stored_contacts[$contact] = $this->project_id; $q->exec(); $q->clear(); } } } $this->stored_contacts = $stored_contacts; CTask::storeTokenTask($this->_AppUI, $this->project_id); parent::hook_postStore(); }
protected function hook_postStore() { $this->_perms->{$this->perm_func}($this->user_id, $this->user_username); $q = $this->_getQuery(); //Lets check if the user has allready default users preferences set, if not insert the default ones $q->addTable('user_preferences', 'upr'); $q->addWhere('upr.pref_user = '******'user_preferences', 'dup'); $q->addWhere('dup.pref_user = 0'); $w2prefs = $q->loadList(); $q->clear(); foreach ($w2prefs as $notUsed => $w2prefsvalue) { $q->addTable('user_preferences', 'up'); $q->addInsert('pref_user', $this->user_id); $q->addInsert('pref_name', $w2prefsvalue['pref_name']); $q->addInsert('pref_value', $w2prefsvalue['pref_value']); $q->exec(); $q->clear(); } } parent::hook_postStore(); }
protected function hook_postStore() { $this->updateAssigned(explode(',', $_POST['event_assigned'])); if (isset($_POST['mail_invited'])) { $this->notify($_POST['event_assigned'], $this->_event == 'Update' ? true : false); } parent::hook_postStore(); }
protected function hook_postStore() { // TODO $oTsk is a global set by store() and is the task before update. // Using it here as a global is probably a bad idea, but the only way until the old task is stored somewhere // else than a global variable... global $oTsk; $q = $this->_query; /* * TODO: I don't like that we have to run an update immediately after the store * but I don't have a better solution at the moment. * ~ caseydk 2012 Aug 04 */ if (!$this->task_parent) { $q->addTable('tasks'); $q->addUpdate('task_parent', $this->task_id); $q->addUpdate('task_updated', "'" . $q->dbfnNowWithTZ() . "'", false, true); $q->addWhere('task_id = ' . (int) $this->task_id); $q->exec(); $q->clear(); } // update dependencies if (!empty($this->task_id)) { $this->updateDependencies($this->getDependencies(), $this->task_parent); } $this->pushDependencies($this->task_id, $this->task_end_date); //split out related departments and store them seperatly. $q->setDelete('task_departments'); $q->addWhere('task_id=' . (int) $this->task_id); $q->exec(); $q->clear(); if (!empty($this->task_departments)) { $departments = explode(',', $this->task_departments); foreach ($departments as $department) { $q->addTable('task_departments'); $q->addInsert('task_id', $this->task_id); $q->addInsert('department_id', $department); $q->exec(); $q->clear(); } } //split out related contacts and store them seperatly. $q->setDelete('task_contacts'); $q->addWhere('task_id=' . (int) $this->task_id); $q->exec(); $q->clear(); if ($this->task_contacts && is_array($this->task_contacts)) { foreach ($this->task_contacts as $contact) { if ($contact) { $q->addTable('task_contacts'); $q->addInsert('task_id', $this->task_id); $q->addInsert('contact_id', $contact); $q->exec(); $q->clear(); } } } // if is child update parent task if ($this->task_parent != $this->task_id) { if (!$this->importing_tasks) { $this->updateDynamics(); } if ($oTsk->task_parent != $this->task_parent) { $old_parent = new CTask(); $old_parent->overrideDatabase($this->_query); $old_parent->load($oTsk->task_parent); $old_parent->updateDynamics(); } } $this->_updatePathEnumeration(); $this->updateDynamics(); $last_task_data = $this->getLastTaskData($this->task_project); CProject::updateTaskCache($this->task_project, $this->task_id, $last_task_data['last_date'], $this->getTaskCount($this->task_project)); parent::hook_postStore(); }
protected function hook_postStore() { $methods = array(); $fields = array(); $values = array(); $contact_methods = $this->contact_methods; if (count($contact_methods)) { foreach ($contact_methods['field'] as $key => $notUsed) { $fields[] = preg_replace("/[^A-Za-z0-9_]/", "", $contact_methods['field'][$key]); $values[] = preg_replace("/[^A-Za-z0-9@:_ \\/\\-\\+\\.\\&\\=\\?\\#]/", "", $contact_methods['value'][$key]); } } $methods['fields'] = $fields; $methods['values'] = $values; $this->setContactMethods($methods); parent::hook_postStore(); }
protected function hook_postStore() { // TODO: I *really* don't like using the POST inside here.. $this->updateAssigned(explode(',', $_POST['event_assigned'])); $custom_fields = new w2p_Core_CustomFields('calendar', 'addedit', $this->event_id, 'edit'); $custom_fields->bind($_POST); $custom_fields->store($this->event_id); // Store Custom Fields parent::hook_postStore(); }
protected function hook_postDelete() { $this->updateTaskSummary(null, $this->_task_id); parent::hook_postStore(); }