public function submitFormGeneratePassword(Form $form) { $values = $form->getValues(); $this->userRow->update(array('password' => md5($values['password']), 'hash' => NULL)); $this->flashMessage($this->translator->translate('admin.sign.passwordChanged')); $this->redirect('default'); }
public function submitFormEdit(Form $form) { $values = $form->getValues(); $this->privilege->update(array('name' => $values->name, 'system_name' => $values->system_name)); $this->flashMessage($this->translator->translate('admin.form.editSuccess')); $this->redirect('edit', $this->privilege->id); }
public function submitFormEdit(Form $form) { $values = $form->getValues(); $data = array('name' => $values->name, 'system_name' => $values->system_name, 'text' => $values->text, 'subject' => $values->subject); $this->row->update($data); $this->flashMessage($this->translator->translate('admin.form.editSuccess')); $this->redirect('edit', $this->row->id); }
public function submitFormEdit(Form $form) { $values = $form->getValues(); $data = array('name' => $values->name == '' ? null : $values->name, 'surname' => $values->surname == '' ? null : $values->surname, 'email' => $values->email, 'role_id' => $values->role_id); $this->row->update($data); $this->flashMessage($this->translator->translate('admin.form.editSuccess')); $this->redirect('edit', $this->row->id); }
public function submitFormEdit(Form $form) { $values = $form->getValues(); $data = array('name' => $values['name'], 'email' => $values['email'], 'google_analytics' => $values['google_analytics'] == '' ? NULL : $values['google_analytics'], 'facebook_link' => $values['facebook_link'] == '' ? NULL : $values['facebook_link'], 'twitter_link' => $values['twitter_link'] == '' ? NULL : $values['twitter_link']); $this->row->update($data); $this->flashMessage($this->translator->translate('admin.form.editSuccess')); $this->redirect('this'); }
public function process(Form $form) { $values = $form->values; $this->onPreSave($values); if ($this->row) { $this->row->update($values); } else { $this->row = $this->database->table($this->table)->insert($values); } $this->onPostSave($this->row); }
public function submitFormEdit(Form $form) { $values = $form->getValues(); if (!$values['external']) { if ($values['link'] == '') { $values['link'] = \Nette\Utils\Strings::webalize($values['name']); } else { $values['link'] = \Nette\Utils\Strings::webalize($values['link']); } } $data = array('name' => $values->name, 'link' => $values->link, 'text' => $values->text, 'title' => $values->title == '' ? null : $values->title, 'keywords' => $values->keywords == '' ? null : $values->keywords, 'description' => $values->description == '' ? null : $values->description, 'module' => $values->module == '' ? null : $values->module, 'is_homepage' => $values->is_homepage ? 'yes' : 'no', 'in_menu' => $values->in_menu ? 'yes' : 'no', 'parent_id' => (int) $values->parent_id == 0 ? null : (int) $values->parent_id, 'h1' => $values->h1 == '' ? null : $values->h1, 'external' => $values->external); $this->row->update($data); $this->flashMessage($this->translator->translate('admin.form.editSuccess')); $this->redirect('edit', $this->row->id); }
public function submitFormEdit(Form $form) { $values = $form->getValues(); if ($values['link'] == '') { $link = \Nette\Utils\Strings::webalize($values['name']); } else { $link = \Nette\Utils\Strings::webalize($values['link']); } $item = $this->model->where('link', $values['link'])->where('NOT id', $this->row['id'])->fetch(); if ($item) { $form['link']->addError($this->translator->translate('new.linkExist')); } else { $data = array('name' => $values['name'], 'link' => $link, 'perex' => $values['perex'] == '' ? null : $values['perex'], 'image' => $values['image'] == '' ? null : $values['image'], 'text' => $values['text']); $this->row->update($data); $this->flashMessage($this->translator->translate('admin.form.editSuccess')); $this->redirect('edit', $this->row->id); } }
public function submitFormEdit(Form $form) { $values = $form->getValues(); if ($values['link'] == '') { $values['link'] = \Nette\Utils\Strings::webalize($values['name']); } else { $values['link'] = \Nette\Utils\Strings::webalize($values['link']); } $category = $this->model->where('link', $values['link'])->where('parent_id', (int) $values['parent_id'] == 0 ? null : (int) $values['parent_id'])->where('NOT id', $this->row['id'])->fetch(); if ($category) { $form['link']->addError($this->translator->translate('category.linkExist')); } else { $data = array('name' => $values->name, 'link' => $values['link'], 'parent_id' => (int) $values->parent_id == 0 ? null : (int) $values->parent_id); $this->row->update($data); $this->flashMessage($this->translator->translate('admin.form.editSuccess')); $this->redirect('edit', $this->row->id); } }
/** @return bool */ public function update() { $this->checkRow(); $status = TRUE; if (!$this->isPersisted()) { $status = $this->row->update($this->modified); $this->reload($this->row); } return $status; }
public function startup() { parent::startup(); $this->cronRow = $this->logCron->getCronRow(); if (!is_object($this->cronRow) || $this->cronRow->id < 1) { $e = new \Nette\InvalidArgumentException("Uknown cron detected!"); $this->logCron->logError($e); $this->logCron->finishTask(); } else { $this->logCronRow = $this->logCron->createLogFromCronId($this->cronRow->id); } $cronRow = $this->cronRow; if ($this->cronRow && isset($this->cronRow->running_flag) && $this->cronRow->running_flag == 1 && $this->context->parameters['productionMode']) { $now = new \DateTime(); $diff = $now->diff($this->cronRow->upd_dt); // if cron was started more than 20 minutes ago, run again. There is big change, there was some error in cron which prevent finishing if ($diff->d > 0 || $diff->h > 0 || $diff->i > 20) { $this->cronRow->update(array('running_flag' => 0, 'upd_process_id' => 'BasePresenter::startup()')); } else { // if cron is requested when previous request is still running, do not allow to run again $this->logCron->setSkippedFlag(true); $this->logCron->finishTask(); } } $this->cronRow->update(array('running_flag' => 1)); // set NewRelic background Job // If no argument or true as an argument is given, mark the current transaction as a background job. // If false is passed as an argument, mark the transaction as a web transaction. if (extension_loaded('newrelic')) { newrelic_background_job(1); } // Check for same tasks in db in interval $dateCheck = new \DateTime(); $dateCheck->add(\DateInterval::createFromDateString('-30 seconds')); $multipleCheck = $this->logCronEntity->getTable()->where("del_flag", 0)->where("cron_id", $this->cronRow->id)->where("ins_dt >= ?", $dateCheck)->count('*'); // Same task run already in period, terminate()! $multipleCheck = 0; if ($multipleCheck > 0) { $this->logCron->setSkippedFlag(true); $this->logCron->finishTask(); } }
/** * Saves entity into database. * @return void */ public function save() { if ($this->isNewEntity()) { $insertValues = $this->getInsertValues(); $row = $this->getTable()->insert($insertValues); $this->loadFromRecord($row); } else { $changedValues = $this->getChangedValues(); $this->row->update($changedValues); } }
public function submitFormEdit(Form $form) { $values = $form->getValues(); $this->resource->update(array('name' => $values->name, 'system_name' => $values->system_name)); foreach ($values as $key => $val) { if (\Nette\Utils\Strings::startsWith($key, 'privilege_')) { $id = explode('_', $key); $resourcePrivilege = $this->resource->related('resource_privilege'); if ($val) { if (!$resourcePrivilege->where('privilege_id = ?', $id[1])->fetch()) { $resourcePrivilege->insert(array('privilege_id' => (int) $id[1])); } } else { if ($resourcePrivilege->where('privilege_id = ?', $id[1])->fetch()) { $resourcePrivilege->where('privilege_id = ?', $id[1])->delete(); $this->permissions->where('resource_id = ?', $this->resource['id'])->where('privilege_id = ?', $id[1])->delete(); } } } } $this->flashMessage($this->translator->translate('admin.form.editSuccess')); $this->redirect('edit', $this->resource->id); }
/** * Updates row. * * @param array|\Traversable $data (column => value) * @return bool */ public function update($data) { return $this->activeRow->update($data); }
public function update(ActiveRow $entity, array $data) { $entity->update($data); }
public function updateUser(ActiveRow $user, array $values) { // todo validate values $user->update($values); }