Beispiel #1
0
 /**
  * Set user time zone
  *
  * @param integer $userId
  * @param string $userName
  * @param integer $timeZoneId
  * @return boolean|string
  */
 public function setUserTimeZone($userId, $userName, $timeZoneId)
 {
     try {
         $this->adapter->getDriver()->getConnection()->beginTransaction();
         $update = $this->update()->table('user_list')->set(['time_zone' => $timeZoneId, 'date_edited' => date('Y-m-d')])->where(['user_id' => $userId]);
         $statement = $this->prepareStatementForSqlObject($update);
         $statement->execute();
         // remove user cache
         $this->removeUserCache($userId);
         $this->adapter->getDriver()->getConnection()->commit();
     } catch (Exception $e) {
         $this->adapter->getDriver()->getConnection()->rollback();
         ApplicationErrorLogger::log($e);
         return $e->getMessage();
     }
     // fire set user's time zone via XmlRpc event
     UserEvent::fireSetTimezoneViaXmlRpcEvent($userId, $userName);
     return true;
 }