public function setForUpdate(Am_Record $record, array $vars) { if (isset($vars['pass'])) { $record->setPass($vars['pass']); unset($vars['pass']); } parent::setForUpdate($record, $vars); }
public function delete() { $ret = parent::delete(); $table_name = $this->getTable()->getName(); $this->getAdapter()->query("UPDATE {$table_name}\n SET sort_order=sort_order-1\n WHERE sort_order>?", $this->sort_order); return $ret; }
function delete() { $this->getAdapter()->query('UPDATE ?_email_template SET email_template_layout_id = NULL WHERE email_template_layout_id=?', $this->pk()); return parent::delete(); }
public function delete() { foreach ($this->loadGetAttachments() as $att) { /* @var $att Upload */ if ($att->prefix == Bootstrap_Helpdesk::ATTACHMENT_UPLOAD_PREFIX) { $att->delete(); } } parent::delete(); }
public function fromRow(array $arr) { // fields to decrypt foreach ($this->_encryptedFields as $f) { if (array_key_exists($f, $arr)) { $arr[$f] = $this->_table->decrypt($arr[$f]); } } return parent::fromRow($arr); }
public function insert($reload = true) { if ($this->currency == Am_Currency::getDefault()) { $this->base_currency_multi = 1.0; } else { $this->base_currency_multi = $this->getDi()->currencyExchangeTable->getRate($this->currency, sqlDate($this->dattm)); } parent::insert($reload); $this->getDi()->hook->call(new Am_Event_PaymentAfterInsert(null, array('payment' => $this, 'invoice' => $this->getInvoice(), 'user' => $this->getInvoice()->getUser()))); return $this; }
public function insert($reload = true) { if ($this->currency == Am_Currency::getDefault()) { $this->base_currency_multi = 1.0; } else { $this->base_currency_multi = $this->getDi()->currencyExchangeTable->getRate($this->currency, sqlDate($this->dattm)); } $ret = parent::insert($reload); $this->getDi()->hook->call('refundAfterInsert', array('invoice' => $this->getInvoice(), 'refund' => $this, 'user' => $this->getInvoice()->getUser())); return $ret; }
public function fromRow(array $vars) { if (isset($vars['childNodes'])) { foreach ($vars['childNodes'] as $row) { $r = new self($this->getTable()); $r->fromRow($row); $this->_childNodes[] = $r; } unset($vars['childNodes']); } return parent::fromRow($vars); }
public function update() { $hm = $this->getDi()->hook; if ($hm->have(Am_Event::ACCESS_AFTER_UPDATE)) { $old = $this->getTable()->load($this->pk()); } parent::update(); $this->runHooks(); if ($hm->have(Am_Event::ACCESS_AFTER_UPDATE)) { $this->getDi()->hook->call(Am_Event::ACCESS_AFTER_UPDATE, array('access' => $this, 'old' => $old)); } return $this; }
/** * before record insertion generate new ticket mask. if the mask is generated, try * 20 times to generate new mask, then throw exception * @return type */ public function insert($reload = true) { $maxAttempts = 20; for ($i = 0; $i <= $maxAttempts; $i++) { try { $this->_generateMask(); return parent::insert($reload); } catch (Am_Exception_Db_NotUnique $e) { if ($i >= $maxAttempts) { throw new Am_Exception_InternalError("Could not generate new ticket mask after [{$i}] attempts"); } $this->ticket_mask = null; } } }
public function delete() { parent::delete(); $this->getDi()->hook->call(Am_Event::ADMIN_AFTER_DELETE, array('admin' => $this)); }
function log(Am_Record $user, Am_Record $notification) { $this->_db->query("INSERT INTO ?_notification_click SET ?a", array('user_id' => $user->pk(), 'dattm' => sqlDate('now'), 'notification_id' => $notification->pk())); }
function __construct(Am_Record $record) { foreach (get_class_vars(get_class($this)) as $k => $v) { if ($k == '_params') { continue; } $this->{$k} = $record->get($k); } $this->setParams(new JRegistry()); $this->aid = $this->gid == 18 ? 1 : 2; $this->guest = 0; }
function getWpCorsewareGroups(Am_Record $record) { return $this->_db->selectCol('SELECT course_id FROM ?_wpcw_user_courses WHERE user_id=?', $record->pk()); }
function getGroups(Am_Record $record) { switch ($this->_groupMode) { case Am_Protect_Databased::GROUP_NONE: return null; case Am_Protect_Databased::GROUP_MULTI: if ($this->_groupTableConfig) { $table = $this->_groupTableConfig[Am_Protect_Table::GROUP_TABLE]; $uidField = $this->_groupTableConfig[Am_Protect_Table::GROUP_UID]; $gidField = $this->_groupTableConfig[Am_Protect_Table::GROUP_GID]; return $this->_db->selectCol("SELECT {$gidField} FROM {$table} WHERE {$uidField}=?", $record->pk()); } break; case Am_Protect_Databased::GROUP_SINGLE: /// may be a field set $field = null; foreach ($this->_fieldsMapping as $a) { list($k, $v) = $a; if ($k == Am_Protect_Table::FIELD_GROUP_ID) { $field = $v; break; } } if ($field) { $v = $record->get($field); return $v; } break; } throw new Am_Exception_NotImplemented(get_class($this) . "->getGroups() is not implemented"); }
function delete() { $this->deleteFromRelatedTable('?_coupon'); parent::delete(); }
public function _valuesToForm(array &$values, Am_Record $record) { if ($record->isLoaded()) { $values['_category'] = $record->getCategories(); } parent::_valuesToForm($values, $record); }
function delete() { $fullPath = $this->getFullPath(); if (file_exists($fullPath)) { if (!unlink($fullPath)) { throw new Am_Exception_InternalError("Could not delete [{$fullPath}], and corresponding database records also is not deleted"); } } parent::delete(); }
protected function addEncryptedPass(Am_Record $user, $lineParsed, $format) { $user_id = $user->pk(); if ($format == SavedPassTable::PASSWORD_PHPASS) { /* Special Case for Native aMember Hash Format */ $field = $this->getImportField('pass', self::FIELD_TYPE_ENCRYPTED_PASS); $user->updateQuick('pass', $field->getValue($lineParsed)); } else { $savedPass = $this->getDi()->savedPassTable->findFirstBy(array('user_id' => $user_id, 'format' => $format)); if (!$savedPass) { $savedPass = $this->getDi()->savedPassRecord; $savedPass->format = $format; $savedPass->user_id = $user_id; } foreach ($this->getImportFields(self::FIELD_TYPE_ENCRYPTED_PASS) as $field) { $field->setValueForRecord($savedPass, $lineParsed); } $savedPass->save(); } $user->data()->set(Am_Protect_Databased::USER_NEED_SETPASS, 1); $user->save(); }
function setGroups(Am_Record $record, $groups) { $old_groups = $this->_plugin->getWP()->get_user_meta($record->pk(), $this->_plugin->getConfig('prefix') . "capabilities"); $ret = array(); foreach ($groups as $k) { if ($k) { $ret[$k] = 1; } } $this->_plugin->getWP()->update_user_meta($record->pk(), $this->_plugin->getConfig('prefix') . "capabilities", $ret); $this->updateLevel($record, $this->getLevelFromCaps($record)); return $ret; }
/** * insert records from $this->_nestedInput * after $record->insert() call */ public function insertNested(Am_Record $record, array $vars) { foreach ($this->_nestedInput as $nest => $records) { $controller = $this->getNestedController($nest); foreach ($records as $rec) { $rec[$this->getNestedKeyField($nest)] = $record->pk(); $request = new Am_Request($rec, 'POST'); $controller->setRequest($request); $controller->postAction(); } } }
public function delete() { parent::delete(); $this->clearAccess(); }
function delete() { parent::delete(); $this->deleteFromRelatedTable('?_aff_commission_commission_rule'); }
function update() { $this->status = get_first($this->status, self::STATUS_CHANGED); parent::update(); }
public function insert($reload = true) { if (!$this->_disablePostbackLog) { parent::insert($reload); } return $this; }
function fromRow(array $vars) { $this->_isLoaded = true; return parent::fromRow($vars); }
/** * Insert any collected fields before starting with child records */ function startNestedTables() { if ($this->record) { $this->record->insert(); } }
public function __sleep() { $ret = parent::__sleep(); $ret[] = '_dataStorage'; return $ret; }
public function insert($reload = true) { $ret = parent::insert(true); $max = $this->getAdapter()->selectCell("SELECT MAX(sort_order) FROM ?_resource_access_sort"); $this->getAdapter()->query("\n INSERT INTO ?_resource_access_sort\n SET resource_id=?d, resource_type=?,\n sort_order=?d\n ", $this->pk(), $this->getAccessType(), 1 + $max); return $ret; }
public function delete() { foreach ($this->getMessages() as $msg) { $msg->delete(); } parent::delete(); }