return true;
}
+ public function getRecordings($account)
+ {
+ $sql = 'SELECT id, filename FROM recordings ' .
+ 'WHERE account_id = (SELECT id FROM accounts WHERE code = ?);';
+ $args = array($account);
+ $msg = 'SQL query in Shout_Driver_Sql#getRecordings(): ' . $sql;
+ Horde::logMessage($msg, 'DEBUG');
+ $result = $this->_db->query($sql, $args);
+ if ($result instanceof PEAR_Error) {
+ throw new Shout_Exception($result);
+ }
+
+ $row = $result->fetchRow(DB_FETCHMODE_ASSOC);
+ if ($row instanceof PEAR_Error) {
+ throw new Shout_Exception($row);
+ }
+
+ $recordings = array();
+ while ($row && !($row instanceof PEAR_Error)) {
+ $id = $row['id'];
+ $recordings[$id] = $row;
+
+ /* Advance to the new row in the result set. */
+ $row = $result->fetchRow(DB_FETCHMODE_ASSOC);
+ }
+
+ $result->free();
+ return $recordings;
+ }
+
+ public function addRecording($account, $name)
+ {
+ $sql = 'INSERT INTO recordings (filename, account_id) ' .
+ 'VALUES (?,(SELECT id FROM accounts WHERE code = ?))';
+ $args = array($name, $account);
+
+ $msg = 'SQL query in Shout_Driver_Sql#addRecording(): ' . $sql;
+ Horde::logMessage($msg, 'DEBUG');
+ $result = $this->_write_db->query($sql, $args);
+ if ($result instanceof PEAR_Error) {
+ throw new Shout_Exception($result);
+ }
+
+ return true;
+ }
+
+ public function deleteRecording($account, $name)
+ {
+ $sql = 'DELETE FROM recordings WHERE filename = ? AND account_id = ' .
+ '(SELECT id FROM accounts WHERE code = ?)';
+ $vars = array($name, $account);
+
+ $msg = 'SQL query in Shout_Driver_Sql#deleteRecording(): ' . $sql;
+ Horde::logMessage($msg, 'DEBUG');
+ $result = $this->_write_db->query($sql, $args);
+ if ($result instanceof PEAR_Error) {
+ throw new Shout_Exception($result);
+ }
+
+ return true;
+ }
+
/**
* Attempts to open a persistent connection to the SQL server.
*
--- /dev/null
+<?php
+/**
+ * Copyright 2010 Alkaloid Networks LLC (http://projects.alkaloid.net)
+ *
+ * See the enclosed file LICENSE for license information (BSD). If you
+ * did not receive this file, see
+ * http://www.opensource.org/licenses/bsd-license.php.
+ *
+ * @package Shout
+ */
+
+class RecordingDetailsForm extends Horde_Form {
+
+ function __construct(&$vars)
+ {
+
+ $formtitle = "Create Recording";
+
+ $curaccount = $_SESSION['shout']['curaccount'];
+ $accountname = $vars->account;
+ $title = sprintf(_("$formtitle"));
+ parent::__construct($vars, $title);
+
+ $this->addHidden('', 'action', 'text', true);
+ $this->addVariable(_("Name"), 'name', 'text', true);
+ //$this->addVariable(_("Description"), 'description', 'text', true);
+ //$this->addVariable(_("Text"), 'text', 'text', true);
+ return true;
+ }
+
+ public function execute()
+ {
+ $shout = $GLOBALS['registry']->getApiInstance('shout', 'application');
+
+ $action = $this->_vars->get('action');
+ $account = $this->_vars->get('account');
+ $name = $this->_vars->get('name');
+
+ $shout->storage->addRecording($account, $name);
+ }
+
+}
+
+class ConferenceDeleteForm extends Horde_Form
+{
+ function __construct(&$vars)
+ {
+ $devid = $vars->get('devid');
+ $account = $vars->get('account');
+
+ $title = _("FIXME Delete Recording %s - Account: %s");
+ $title = sprintf($title, $devid, $_SESSION['shout']['accounts'][$account]['name']);
+ parent::__construct($vars, $title);
+
+ $this->addHidden('', 'account', 'text', true);
+ $this->addHidden('', 'devid', 'text', true);
+ $this->addHidden('', 'action', 'text', true);
+ $this->setButtons(array(_("Delete"), _("Cancel")));
+ }
+
+ function execute()
+ {
+ throw new Shout_Exception('FIXME');
+ $shout = $GLOBALS['registry']->getApiInstance('shout', 'application');
+ $account = $this->_vars->get('account');
+ $devid = $this->_vars->get('devid');
+ $shout->devices->deleteDevice($account, $devid);
+ }
+}
\ No newline at end of file