public function handleConfiguration(Configuration $config) { $fields = array('site_title' => $config->site_title, 'site_description' => $config->site_description, 'site_keywords' => $config->site_keywords, 'admin_email' => $config->admin_email); try { if ($this->table_gateway->insert($fields) > 0) { return true; } } catch (\ErrorException $e) { // log the message to the error file ErrorHandler::errorWriter($e->getMessage()); } }
public function updatePage(Pages $pages, $id) { try { // update the page with the values from the forms (after filter) // the update where clause is based on $id $data = array('page_title' => $pages->page_title, 'page_content' => $pages->page_content); $this->table_gateway->update($data, array('page_id' => (int) $id)); return true; } catch (\ErrorException $e) { // log the message to the error file ErrorHandler::errorWriter($e->getMessage()); } }
public function addUser(Users $users) { $fields = array('username' => $users->username, 'password' => hash('sha512', $users->password), 'first_name' => $users->first_name, 'last_name' => $users->last_name, 'gender' => $users->gender, 'address' => $users->address, 'city' => $users->city, 'state' => $users->state, 'zipcode' => $users->zipcode, 'country' => $users->country); try { if ($this->table_gateway->insert($fields) > 0) { return true; } } catch (\ErrorException $e) { // log the message to the error file ErrorHandler::errorWriter($e->getMessage()); } }
public function modifyEmailTemplate(EmailTemplates $email_tpls, $id) { // first we need to check if the email template exist (can't update a non-existent one right ;)?) // if it does, update the template with the supplied values // if it doesn't, bail out (admin should use the saveEmailTemplate method instead) $select = $this->table_gateway->select(array('template_id' => $id)); $row = $select->current(); if (null !== $row) { // record was found // update it now try { $data = array('email_subject' => $email_tpls->email_subject, 'email_body' => $email_tpls->email_body); $this->table_gateway->update($data, array('template_id' => $id)); return true; } catch (\ErrorException $e) { // log the message to the error file ErrorHandler::errorWriter($e->getMessage()); } } // no record was found // return false return false; }