public function __construct($id = null) { $this->db_table = 'doc_filetype_forbidden'; $this->belongs_to['userConfig'] = array('class_name' => 'DocUsergroupConfig', 'foreign_key' => 'usergroup'); $this->belongs_to['filetype'] = array('class_name' => 'DocFiletype', 'foreign_key' => 'dateityp_id'); parent::__construct($id); }
function tearDown() { SimpleORMap::expireTableScheme(); Config::set(null); StudipCacheFactory::setConfig(null); $GLOBALS['CACHING_ENABLE'] = false; }
protected static function configure($config = array()) { $config['db_table'] = 'archiv_user'; $config['belongs_to']['user'] = array('class_name' => 'User', 'foreign_key' => 'user_id'); $config['belongs_to']['course'] = array('class_name' => 'ArchivedCourse', 'foreign_key' => 'seminar_id'); parent::configure($config); }
/** * Give primary key of record as param to fetch * corresponding record from db if available, if not preset primary key * with given value. Give null to create new record * * @param mixed $id primary key of table */ public function __construct($id = null) { $this->db_table = 'seminar_tabs'; $this->belongs_to['course'] = array('class_name' => '\\Course', 'foreign_key' => 'seminar_id'); // workaround for Stud.IP ticket:5312 //$options = $this->getRelationOptions('course'); //$options = $this->getRelationOptions('parent'); /** $this->has_many['children'] = array( 'class_name' => 'Mooc\\DB\\Block', 'assoc_foreign_key' => 'parent_id', 'assoc_func' => 'findByParent_id', 'on_delete' => 'delete', 'on_store' => 'store' ); $this->registerCallback('before_create', 'ensureSeminarId'); $this->registerCallback('before_create', 'ensurePositionId'); $this->registerCallback('before_store', 'validate'); $this->registerCallback('after_delete', 'destroyFields'); $this->registerCallback('after_delete', 'destroyUserProgress'); $this->registerCallback('after_delete', 'updatePositionsAfterDelete'); $events = words('after_create after_update after_store after_delete'); $this->registerCallback($events, 'callbackToMetrics'); **/ parent::__construct($id); }
function delete() { $old_assign_object = new AssignObject($this->id); $ret = parent::delete(); $old_assign_object->delete(); return $ret; }
function up() { $db = DbManager::get(); $db->exec("ALTER TABLE `datafields` CHANGE `type` `type` ENUM('bool','textline','textarea','selectbox','date','time','email','phone','radio','combo','link','selectboxmultiple') NOT NULL DEFAULT 'textline'"); $db->exec("ALTER TABLE `datafields` ADD `is_userfilter` TINYINT UNSIGNED NOT NULL DEFAULT '0' AFTER `is_required`"); SimpleORMap::expireTableScheme(); }
protected static function configure($config = array()) { $config['db_table'] = 'archiv'; $config['has_many']['members'] = array('class_name' => 'ArchivedCourseMember', 'on_delete' => 'delete', 'on_store' => 'store'); $config['belongs_to']['home_institut'] = array('class_name' => 'Institute', 'foreign_key' => 'heimat_inst_id'); parent::configure($config); }
protected static function configure($config = array()) { $config['db_table'] = 'scm_tabs'; $config['belongs_to']['user'] = array('class_name' => 'User', 'foreign_key' => 'user_id'); $config['belongs_to']['course'] = array('class_name' => 'Course', 'foreign_key' => 'range_id'); parent::configure($config); }
protected static function configure($config = array()) { $config['db_table'] = 'questionnaire_answers'; $config['belongs_to']['question'] = array('class_name' => 'QuestionnaireQuestion'); $config['serialized_fields']['answerdata'] = "JSONArrayObject"; parent::configure($config); }
protected static function configure($config = array()) { $config['db_table'] = 'questionnaires'; $config['has_many']['questions'] = array('class_name' => 'QuestionnaireQuestion', 'on_delete' => 'delete', 'on_store' => 'store'); $config['has_many']['assignments'] = array('class_name' => 'QuestionnaireAssignment', 'on_delete' => 'delete', 'on_store' => 'store'); parent::configure($config); }
protected static function configure($config = array()) { $config['db_table'] = 'pluginmarket_plugin_usages'; $config['belongs_to']['plugin'] = array('class_name' => 'MarketPlugin', 'foreign_key' => 'plugin_id'); $config['belongs_to']['user'] = array('class_name' => 'User', 'foreign_key' => 'user_id'); parent::configure($config); }
/** * Initialize a new directory entry object for the given id. * * @param string $id directory entry id * @throws InvalidArgumentException if id of directory entry is invalid */ public function __construct($id = null) { parent::__construct($id); if ($id !== null && $this->isNew()) { throw new InvalidArgumentException('directory entry not found'); } }
public function store() { if (!$this['public_key']) { $this->createKeys(); } return parent::store(); }
protected static function configure($config = array()) { $config['db_table'] = 'contact'; $config['belongs_to']['owner'] = array('class_name' => 'User', 'foreign_key' => 'owner_id'); $config['belongs_to']['friend'] = array('class_name' => 'User', 'foreign_key' => 'user_id'); $config['has_many']['group_assignments'] = array('class_name' => 'StatusgruppeUser', 'foreign_key' => 'user_id', 'assoc_foreign_key' => 'user_id', 'on_delete' => 'delete', 'on_store' => 'store'); parent::configure($config); }
protected static function configure($config = array()) { $config['db_table'] = 'eval'; $config['belongs_to']['author'] = array('class_name' => 'User', 'foreign_key' => 'author_id'); $config['has_and_belongs_to_many']['participants'] = array('class_name' => 'User', 'thru_table' => 'eval_user'); $config['additional_fields']['enddate'] = true; parent::configure($config); }
function up() { $db = DBManager::get(); $db->exec("ALTER TABLE `resources_requests` ADD `metadate_id` VARCHAR( 32 ) NOT NULL DEFAULT '' AFTER `termin_id`"); $db->exec("ALTER TABLE `resources_requests` DROP INDEX `closed` , ADD INDEX `closed` ( `closed` , `request_id`, `resource_id` )"); $db->exec("ALTER TABLE `resources_requests` ADD INDEX ( `metadate_id` )"); SimpleORMap::expireTableScheme(); }
function __construct($id = null) { if (version_compare($GLOBALS['SOFTWARE_VERSION'], "3.2", "<")) { $this->registerCallback('before_store', 'cbSerializeData'); $this->registerCallback('after_store after_initialize', 'cbUnserializeData'); } parent::__construct($id); }
/** * Deletes the asset. * * @return int indicating how many rows were deleted */ public function delete() { $filename = $this->getFilepath(); if (file_exists($filename)) { unlink($filename); } return parent::delete(); }
/** * {@inheritdoc } */ public function delete() { // Resort members $query = "UPDATE statusgruppe_user SET position = position - 1 WHERE statusgruppe_id = ? AND position > ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($this->statusgruppe_id, $this->position)); return parent::delete(); }
protected static function configure($config = array()) { $config['db_table'] = 'aux_lock_rules'; $config['belongs_to']['course'] = array('class_name' => 'Course', 'foreign_key' => 'lock_id', 'assoc_foreign_key' => 'aux_lock_rule'); $config['additional_fields']['datafields'] = true; $config['additional_fields']['order'] = true; parent::configure($config); }
protected static function configure($config = array()) { $config['db_table'] = 'log_events'; $config['belongs_to']['action'] = array('class_name' => 'LogAction', 'foreign_key' => 'action_id'); $config['belongs_to']['user'] = array('class_name' => 'User', 'foreign_key' => 'user_id'); $config['notification_map']['after_create'] = 'LogEventDidCreate'; $config['notification_map']['before_create'] = 'LogEventWillCreate'; parent::configure($config); }
public function up() { DBManager::get()->exec("\n ALTER TABLE `pluginmarket_plugins`\n ADD `rating` DOUBLE NULL AFTER `language` ;\n "); SimpleORMap::expireTableScheme(); foreach (MarketPlugin::findBySQL("1=1") as $plugin) { $plugin['rating'] = $plugin->calculateRating(); $plugin->store(); } }
protected static function configure($config = array()) { $config['db_table'] = 'questionnaire_questions'; $config['belongs_to']['questionnaire'] = array('class_name' => 'Questionnaire', 'foreign_key' => 'questionnaire_id'); $config['has_many']['answers'] = array('class_name' => 'QuestionnaireAnswer'); $config['has_many']['relations'] = array('class_name' => 'QuestionnaireRelation'); $config['serialized_fields']['questiondata'] = "JSONArrayObject"; parent::configure($config); }
/** * Returns the study area with the specified ID. */ static function find($id) { $result = NULL; if ($id === self::ROOT) { $result = self::getRootArea(); } else { $result = parent::find($id); } return $result; }
public function down() { $db = DBManager::get(); $db->exec("ALTER TABLE scm CHANGE tab_name tab_name varchar(20) NOT NULL DEFAULT 'Info',\n CHANGE content content text"); $db->exec("ALTER TABLE user_info CHANGE lebenslauf lebenslauf text,\n CHANGE publi publi text NOT NULL"); $db->exec("ALTER TABLE wiki CHANGE keyword keyword varchar(128) BINARY NOT NULL DEFAULT '',\n CHANGE body body text"); $db->exec("ALTER TABLE wiki_links CHANGE from_keyword from_keyword char(128) BINARY NOT NULL DEFAULT '',\n CHANGE to_keyword to_keyword char(128) BINARY NOT NULL DEFAULT ''"); $db->exec("ALTER TABLE wiki_locks CHANGE keyword keyword varchar(128) BINARY NOT NULL DEFAULT ''"); SimpleORMap::expireTableScheme(); }
protected static function configure($config = array()) { $config['db_table'] = 'news_range'; $config['belongs_to']['user'] = array('class_name' => 'User', 'foreign_key' => 'range_id'); $config['belongs_to']['course'] = array('class_name' => 'Course', 'foreign_key' => 'range_id'); $config['belongs_to']['institute'] = array('class_name' => 'Institute', 'foreign_key' => 'range_id'); $config['additional_fields']['type'] = true; $config['additional_fields']['name'] = true; parent::configure($config); }
function down() { $db = DBManager::get(); $db->exec("ALTER TABLE `lock_rules` CHANGE `permission` `permission` ENUM( 'tutor', 'dozent', 'admin', 'root' ) NOT NULL DEFAULT 'dozent'"); $db->exec("ALTER TABLE `lock_rules` DROP `object_type`"); $db->exec("ALTER TABLE `lock_rules` DROP `user_id`"); $db->exec("ALTER TABLE `user_info` DROP `lock_rule`"); $db->exec("ALTER TABLE `Institute` DROP `lock_rule`"); SimpleORMap::expireTableScheme(); }
protected static function configure($config = array()) { $config['db_table'] = 'user_studiengang'; $config['belongs_to']['user'] = array('class_name' => 'User', 'foreign_key' => 'user_id'); $config['belongs_to']['degree'] = array('class_name' => 'Degree', 'foreign_key' => 'abschluss_id'); $config['belongs_to']['studycourse'] = array('class_name' => 'StudyCourse', 'foreign_key' => 'studiengang_id'); $config['additional_fields']['degree_name'] = array(); $config['additional_fields']['studycourse_name'] = array(); parent::configure($config); }
/** * Delete all the links to this file and the file itself. */ public function delete() { $db = DBManager::get(); if (isset($this->storage_object)) { $this->storage_object->delete(); } $stmt = $db->prepare('DELETE FROM file_refs WHERE file_id = ?'); $stmt->execute(array($this->file_id)); parent::delete(); }
public function down() { $query = "ALTER TABLE `seminare`\n DROP COLUMN `is_complete`"; DBManager::get()->exec($query); SimpleORMap::expireTableScheme(); $query = "DELETE FROM `config` WHERE `field` = :field"; $statement = DBManager::get()->prepare($query); $statement->bindValue(':field', 'ADMIN_COURSES_SHOW_COMPLETE'); $statement->execute(); }