Author: Jan Schneider (jan@horde.org)
Inheritance: extends Horde_Translation_Autodetect
Example #1
0
 /**
  * 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));
 }
Example #2
0
 /**
  * Returns the plural translation of a message.
  *
  * @param string $singular  The singular version to translate.
  * @param string $plural    The plural version to translate.
  * @param integer $number   The number that determines singular vs. plural.
  *
  * @return string  The string translation, or the original string if no
  *                 translation exists.
  */
 public static function ngettext($singular, $plural, $number)
 {
     self::$_domain = 'Horde_Alarm';
     self::$_directory = '@data_dir@' == '@' . 'data_dir' . '@' ? __DIR__ . '/../../../locale' : '@data_dir@/Horde_Alarm/locale';
     return parent::ngettext($singular, $plural, $number);
 }
Example #3
0
 /**
  * Returns a human readable description of the handler.
  *
  * @return string
  */
 public function getDescription()
 {
     return Horde_Alarm_Translation::t("Desktop notification (with certain browsers)");
 }
Example #4
0
 /**
  * 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));
 }
Example #5
0
File: Sql.php Project: horde/horde
 /**
  * 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);
 }
Example #6
0
 /**
  * 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."));
     }
 }