/** * Returns a hash of user-configurable parameters for the handler. * * The parameters are hashes with parameter names as keys and parameter * information as values. The parameter information is a hash with the * following keys: * - type: the parameter type as a preference type. * - desc: a parameter description. * - required: whether this parameter is required. * * @return array */ public function getParameters() { return array('sound' => array('type' => 'sound', 'desc' => Horde_Alarm_Translation::t("Play a sound?"), 'required' => false)); }
/** * Returns a human readable description of the handler. * * @return string */ public function getDescription() { return Horde_Alarm_Translation::t("Desktop notification (with certain browsers)"); }
/** * Converts results from TEXT columns to strings. * * @param string $column A column name. * @param mixed $value A TEXT column value. * * @return string The column value as plain string. */ protected function _convertBinary($column, $value) { try { $columns = $this->_db->columns($this->_params['table']); } catch (Horde_Db_Exception $e) { throw new Horde_Alarm_Exception(Horde_Alarm_Translation::t("Server error when querying database.")); } return $columns[$column]->binaryToString($value); }
/** * Returns a hash of user-configurable parameters for the handler. * * The parameters are hashes with parameter names as keys and parameter * information as values. The parameter information is a hash with the * following keys: * - type: the parameter type as a preference type. * - desc: a parameter description. * - required: whether this parameter is required. * * @return array */ public function getParameters() { return array('email' => array('type' => 'text', 'desc' => Horde_Alarm_Translation::t("Email address (optional)"), 'required' => false)); }
/** * Deletes an alarm from the backend. * * @param string $id The alarm's unique id. * @param string $user The alarm's user. All users' alarms if null. * * @throws Horde_Alarm_Exception */ protected function _delete($id, $user = null) { $query = sprintf('DELETE FROM %s WHERE alarm_id = ?', $this->_params['table']); $values = array($id); if (!is_null($user)) { $query .= empty($user) ? ' AND (alarm_uid IS NULL OR alarm_uid = ?)' : ' AND alarm_uid = ?'; $values[] = $user; } try { $this->_db->delete($query, $values); } catch (Horde_Db_Exception $e) { throw new Horde_Alarm_Exception(Horde_Alarm_Translation::t("Server error when querying database.")); } }