mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2025-07-11 10:58:48 +00:00
Initial Release of the calendar plugin
This commit is contained in:
parent
45cc9885fc
commit
7115197a33
561 changed files with 189494 additions and 0 deletions
50
dav/common/dbclasses/dbclass_animexx.class.php
Normal file
50
dav/common/dbclasses/dbclass_animexx.class.php
Normal file
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
|
||||
class DBClass_animexx
|
||||
{
|
||||
protected $_string_fields = array();
|
||||
protected $_int_fields = array();
|
||||
protected $_float_fields = array();
|
||||
protected $_null_fields = array();
|
||||
|
||||
public $PRIMARY_KEY = array();
|
||||
protected $SRC_TABLE = "";
|
||||
|
||||
/**
|
||||
* @param $dbarray_or_id
|
||||
* @throws Exception
|
||||
*/
|
||||
function __construct($dbarray_or_id)
|
||||
{
|
||||
if (is_numeric($dbarray_or_id) && count($this->PRIMARY_KEY) == 1) {
|
||||
$dbarray_or_id = q("SELECT * FROM %s%s%s WHERE %s=%d",
|
||||
CALDAV_SQL_DB, CALDAV_SQL_PREFIX, $this->SRC_TABLE, $this->PRIMARY_KEY[0], IntVal($dbarray_or_id)
|
||||
);
|
||||
if (count($dbarray_or_id) == 0) throw new Exception("Not found");
|
||||
$dbarray_or_id = $dbarray_or_id[0];
|
||||
}
|
||||
if (is_array($dbarray_or_id)) {
|
||||
foreach ($this->_string_fields as $field) {
|
||||
$this->$field = $dbarray_or_id[$field];
|
||||
}
|
||||
foreach ($this->_int_fields as $field) {
|
||||
$this->$field = IntVal($dbarray_or_id[$field]);
|
||||
}
|
||||
foreach ($this->_float_fields as $field) {
|
||||
$this->$field = FloatVal($dbarray_or_id[$field]);
|
||||
}
|
||||
} else throw new Exception("Not found");
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
function toArray()
|
||||
{
|
||||
$arr = array();
|
||||
foreach ($this->_string_fields as $field) $arr[$field] = $this->$field;
|
||||
foreach ($this->_int_fields as $field) $arr[$field] = $this->$field;
|
||||
foreach ($this->_float_fields as $field) $arr[$field] = $this->$field;
|
||||
return $arr;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue