/** update a dates - internal, do not use -> use method save * this method updates the database record for a given dates item * * @param cs_dates_item the dates item for which an update should be made * * @author CommSy Development Group */ function _update($item) { parent::_update($item); $modificator = $item->getModificatorItem(); $current_datetime = getCurrentDateTimeInMySQL(); if ($item->isPublic()) { $public = '1'; } else { $public = '0'; } $modification_date = getCurrentDateTimeInMySQL(); if ($item->isNotActivated()) { $modification_date = $item->getModificationDate(); } $query = 'UPDATE ' . $this->addDatabasePrefix('dates') . ' SET ' . 'modifier_id="' . encode(AS_DB, $modificator->getItemID()) . '",' . 'modification_date="' . $modification_date . '",' . 'title="' . encode(AS_DB, $item->getTitle()) . '",' . 'public="' . encode(AS_DB, $public) . '",' . 'description="' . encode(AS_DB, $item->getDescription()) . '",' . 'start_time="' . encode(AS_DB, $item->getStartingTime()) . '",' . 'start_day="' . encode(AS_DB, $item->getStartingDay()) . '",' . 'end_time="' . encode(AS_DB, $item->getEndingTime()) . '",' . 'end_day="' . encode(AS_DB, $item->getEndingDay()) . '",' . 'datetime_start="' . encode(AS_DB, $item->getDateTime_start()) . '",' . 'datetime_end="' . encode(AS_DB, $item->getDateTime_end()) . '",' . 'place="' . encode(AS_DB, $item->getPlace()) . '",' . 'date_mode="' . encode(AS_DB, $item->getDateMode()) . '"'; $color = $item->getColor(); if (!empty($color)) { $query .= ', color="' . encode(AS_DB, $item->getColor()) . '"'; } else { $query .= ', color=NULL'; } $rev_id = $item->getRecurrenceId(); if (!empty($rev_id)) { $query .= ', recurrence_id="' . encode(AS_DB, $item->getRecurrenceId()) . '"'; } else { $query .= ', recurrence_id=NULL'; } $rev_pattern = $item->getRecurrencePattern(); if (!empty($rev_pattern)) { $query .= ', recurrence_pattern="' . encode(AS_DB, serialize($item->getRecurrencePattern())) . '"'; } else { $query .= ', recurrence_pattern=NULL'; } $query .= ' WHERE item_id="' . encode(AS_DB, $item->getItemID()) . '"'; $result = $this->_db_connector->performQuery($query); if (!isset($result) or !$result) { include_once 'functions/error_functions.php'; trigger_error('Problems updating dates.', E_USER_WARNING); } unset($modificator); unset($item); }
/** update a task - internal, do not use -> use method save * this method updates a task * * @param object cs_item task_item the task */ function _update($item) { parent::_update($item); $query = 'UPDATE ' . $this->addDatabasePrefix('tasks') . ' SET ' . 'modification_date="' . getCurrentDateTimeInMySQL() . '",' . 'title="' . encode(AS_DB, $item->getTitle()) . '",' . 'status="' . encode(AS_DB, $item->getStatus()) . '"' . ' WHERE item_id="' . encode(AS_DB, $item->getItemID()) . '"'; // extras (TBD) $result = $this->_db_connector->performQuery($query); if (!isset($result) or !$result) { include_once 'functions/error_functions.php'; trigger_error('Problems updateing task items from query: "' . $query . '"', E_USER_WARNING); } unset($item); }
/** update an announcement - internal, do not use -> use method save * this method updates an announcement * * @param object cs_item announcement_item the announcement * * @author CommSy Development Group */ function _update($announcement_item) { parent::_update($announcement_item); $modificator = $announcement_item->getModificatorItem(); $current_datetime = getCurrentDateTimeInMySQL(); if ($announcement_item->isPublic()) { $public = '1'; } else { $public = '0'; } $modification_date = getCurrentDateTimeInMySQL(); if ($announcement_item->isNotActivated()) { $modification_date = $announcement_item->getModificationDate(); } $query = 'UPDATE ' . $this->addDatabasePrefix('announcement') . ' SET ' . 'modifier_id="' . encode(AS_DB, $modificator->getItemID()) . '",' . 'modification_date="' . $modification_date . '",' . 'title="' . encode(AS_DB, $announcement_item->getTitle()) . '",' . 'description="' . encode(AS_DB, $announcement_item->getDescription()) . '",' . 'public="' . encode(AS_DB, $public) . '",' . 'enddate="' . encode(AS_DB, $announcement_item->getSecondDateTime()) . '"' . ' WHERE item_id="' . encode(AS_DB, $announcement_item->getItemID()) . '"'; $result = $this->_db_connector->performQuery($query); if (!isset($result) or !$result) { include_once 'functions/error_functions.php'; trigger_error('Problems updating announcement.', E_USER_WARNING); } else { unset($result); } unset($announcement_item); unset($modificator); }
/** update a tag - internal, do not use -> use method save * this method updates a tag * * @param object cs_item tag_item the tag */ function _update($item) { parent::_update($item); $modificator = $item->getModificatorItem(); $current_datetime = getCurrentDateTimeInMySQL(); $query = 'UPDATE ' . $this->addDatabasePrefix($this->_db_table) . ' SET ' . 'modifier_id="' . encode(AS_DB, $modificator->getItemID()) . '",' . 'modification_date="' . $current_datetime . '",' . 'title="' . encode(AS_DB, $item->getTitle()) . '"' . ' WHERE item_id="' . encode(AS_DB, $item->getItemID()) . '"'; $result = $this->_db_connector->performQuery($query); if (!isset($result) or !$result) { include_once 'functions/error_functions.php'; trigger_error('Problems updating ' . $this->_db_table . ': "' . $this->_dberror . '" from query: "' . $query . '"', E_USER_WARNING); } }
/** update a link item - internal, do not use -> use method save * this method updates a link item * * @param object cs_item link_item */ function _update($link_item) { // wird nicht benötigt??? parent::_update($link_item); $first_item = $link_item->getFirstLinkedItem(); $second_item = $link_item->getSecondLinkedItem(); $modificator = $link_item->getModificatorItem(); $query = 'UPDATE ' . $this->addDatabasePrefix('link_items') . ' SET ' . 'modification_date="' . getCurrentDateTimeInMySQL() . '",' . 'first_item_id="' . encode(AS_DB, $first_item->getItemID()) . '",' . 'second_item_id="' . encode(AS_DB, $second_item->getItemID()) . '",' . 'first_item_type="' . encode(AS_DB, $link_item->getFirstLinkedItemType()) . '",' . 'second_item_type="' . encode(AS_DB, $link_item->getSecondLinkedItemType()) . '",'; if ($link_item->getSortingPlace() != '') { $query .= 'sorting_place="' . encode(AS_DB, $link_item->getSortingPlace()) . '",'; } $query .= 'sorting_place="' . encode(AS_DB, $link_item->getSortingPlace()) . '",' . 'extras="' . encode(AS_DB, serialize($link_item->getExtraInformation())) . '"' . ' WHERE item_id="' . encode(AS_DB, $link_item->getItemID()) . '"'; $result = $this->_db_connector->performQuery($query); if (!isset($result) or !$result) { include_once 'functions/error_functions.php'; trigger_error('Problems updating link item from query: "' . $query . '"', E_USER_WARNING); } }
/** update an annotation - internal, do not use -> use method save * this method updates an annotation * * @param object cs_item annotation_item the annotation * * @author CommSy Development Group */ function _update($annotation_item) { parent::_update($annotation_item); if ($annotation_item->getLinkedVersionID()) { $version_id = $annotation_item->getLinkedVersionID(); } else { $version_id = '0'; } $query = 'UPDATE ' . $this->addDatabasePrefix('annotations') . ' SET ' . 'modification_date="' . getCurrentDateTimeInMySQL() . '",' . 'title="' . encode(AS_DB, $annotation_item->getTitle()) . '",' . 'description="' . encode(AS_DB, $annotation_item->getDescription()) . '",' . 'linked_item_id="' . encode(AS_DB, $annotation_item->getLinkedItemID()) . '",' . 'linked_version_id="' . encode(AS_DB, $version_id) . '",' . 'modifier_id="' . encode(AS_DB, $this->_current_user->getItemID()) . '"' . ' WHERE item_id="' . encode(AS_DB, $annotation_item->getItemID()) . '"'; $result = $this->_db_connector->performQuery($query); if (!isset($result) or !$result) { include_once 'functions/error_functions.php'; trigger_error('Problems updating annotation item.', E_USER_ERROR); } unset($annotation_item); }
/** update a step - internal, do not use -> use method save * this method updates the database record for a given step item * * @param cs_step_item the step item for which an update should be made * @param bool can disable setting of new modification date */ function _update($item) { $date_string = ''; if (!$this->_save_step_without_date) { parent::_update($item); $date_string = 'modification_date="' . getCurrentDateTimeInMySQL() . '",'; } $modificator_item = $item->getModificatorItem(); $query = 'UPDATE ' . $this->addDatabasePrefix('step') . ' SET ' . $date_string . 'title="' . encode(AS_DB, $item->getTitle()) . '",' . 'description="' . encode(AS_DB, $item->getDescription()) . '",' . 'minutes="' . encode(AS_DB, $item->getMinutes()) . '",' . 'time_type="' . encode(AS_DB, $item->getTimeType()) . '",' . 'todo_item_id="' . encode(AS_DB, $item->getTodoID()) . '",' . 'modifier_id="' . encode(AS_DB, $modificator_item->getItemID()) . '"' . ' WHERE item_id="' . encode(AS_DB, $item->getItemID()) . '"'; // extras (TBD) $result = $this->_db_connector->performQuery($query); if (!isset($result) or !$result) { include_once 'functions/error_functions.php'; trigger_error('Problems updating step from query: "' . $query . '"', E_USER_WARNING); } $this->_save_step_without_date = false; //restore default unset($item); }
/** update an homepage - internal, do not use -> use method save * this method updates an homepage * * @param object cs_item homepage_item the homepage */ function _update($homepage_item) { parent::_update($homepage_item); $modificator = $homepage_item->getModificatorItem(); $current_datetime = getCurrentDateTimeInMySQL(); if ($homepage_item->isPublic()) { $public = '1'; } else { $public = '0'; } $query = 'UPDATE ' . $this->addDatabasePrefix($this->_db_table) . ' SET ' . 'modifier_id="' . encode(AS_DB, $modificator->getItemID()) . '",' . 'modification_date="' . encode(AS_DB, $current_datetime) . '",' . 'title="' . encode(AS_DB, $homepage_item->getTitle()) . '",' . 'description="' . encode(AS_DB, $homepage_item->getDescription()) . '",' . 'public="' . encode(AS_DB, $public) . '",' . 'page_type="' . encode(AS_DB, $homepage_item->getPageType()) . '"' . ' WHERE item_id="' . encode(AS_DB, $homepage_item->getItemID()) . '"'; $result = $this->_db_connector->performQuery($query); if (!isset($result) or !$result) { include_once 'functions/error_functions.php'; trigger_error('Problems updating homepage from query: "' . $query . '"', E_USER_WARNING); } unset($homepage_item); unset($modificator); }
/** update a discussion - internal, do not use -> use method save * this method updates the database record for a given discussion item * * @param cs_discussion_item the discussion item for which an update should be made */ function _update($item) { parent::_update($item); $modificator = $item->getModificatorItem(); $current_datetime = getCurrentDateTimeInMySQL(); if ($item->isPublic()) { $public = '1'; } else { $public = '0'; } if ($item->getDiscussionStatus()) { $status = $item->getDiscussionStatus(); } else { $status = '1'; } if ($item->getDiscussionType()) { $type = $item->getDiscussionType(); } else { $type = 'simple'; } $modification_date = getCurrentDateTimeInMySQL(); if ($item->isNotActivated()) { $modification_date = $item->getModificationDate(); } $query = 'UPDATE ' . $this->addDatabasePrefix('discussions') . ' SET ' . 'modifier_id="' . encode(AS_DB, $modificator->getItemID()) . '",' . 'modification_date="' . $modification_date . '",' . 'title="' . encode(AS_DB, $item->getTitle()) . '",' . 'extras="' . encode(AS_DB, serialize($item->getExtraInformation())) . '",' . 'public="' . encode(AS_DB, $public) . '"'; $article_id = $item->getLatestArticleID(); if (!empty($article_id)) { $query .= ', latest_article_item_id="' . encode(AS_DB, $article_id) . '"'; } $article_modification_date = $item->getLatestArticleModificationDate(); if (!empty($article_modification_date)) { $query .= ', latest_article_modification_date="' . encode(AS_DB, $article_modification_date) . '"'; } $query .= ', status="' . encode(AS_DB, $status) . '"'; $query .= ', discussion_type="' . encode(AS_DB, $type) . '"'; $query .= ' WHERE item_id="' . encode(AS_DB, $item->getItemID()) . '"'; $result = $this->_db_connector->performQuery($query); if (!isset($result) or !$result) { include_once 'functions/error_functions.php'; trigger_error('Problems updating discussion', E_USER_WARNING); } unset($item); unset($modificator); }
function _update($portfolio_item) { parent::_update($portfolio_item); $modification_date = getCurrentDateTimeInMySQL(); $portfolio_template = $portfolio_item->getTemplate(); if (empty($portfolio_template)) { $template = -1; } else { $template = $portfolio_item->getTemplate(); } $query = 'UPDATE ' . $this->addDatabasePrefix($this->_db_table) . ' SET ' . 'modification_date="' . $modification_date . '",' . 'modifier_id="' . encode(AS_DB, $portfolio_item->getModificatorID()) . '",' . 'title="' . encode(AS_DB, $portfolio_item->getTitle()) . '",' . 'description="' . encode(AS_DB, $portfolio_item->getDescription()) . '",' . 'template="' . encode(AS_DB, $template) . '"' . ' WHERE item_id="' . encode(AS_DB, $portfolio_item->getItemID()) . '"'; $result = $this->_db_connector->performQuery($query); if (!isset($result) or !$result) { include_once 'functions/error_functions.php'; trigger_error('Problems updating portfolio.', E_USER_WARNING); } else { unset($result); } $this->_updateExternalViewer($portfolio_item); $this->_updateExternalTemplate($portfolio_item); unset($portfolio_item); }
/** update a label - internal, do not use -> use method save * this method updates a label * * @param object cs_item label_item the label * * @author CommSy Development Group */ function _update($item) { parent::_update($item); $modificator = $item->getModificatorItem(); $modification_date = getCurrentDateTimeInMySQL(); if ($item->isPublic()) { $public = 1; } else { $public = 0; } if ($item->isNotActivated()) { $modification_date = $item->getModificationDate(); } $query = 'UPDATE ' . $this->addDatabasePrefix('labels') . ' SET ' . 'modifier_id="' . encode(AS_DB, $modificator->getItemID()) . '",' . 'modification_date="' . $modification_date . '",'; if (!($item->getLabelType() == CS_GROUP_TYPE and $item->isSystemLabel())) { $query .= 'name="' . encode(AS_DB, $item->getTitle()) . '",'; } $query .= 'description="' . encode(AS_DB, $item->getDescription()) . '",' . 'public="' . encode(AS_DB, $public) . '",' . "extras='" . encode(AS_DB, serialize($item->getExtraInformation())) . "'" . ' WHERE item_id="' . encode(AS_DB, $item->getItemID()) . '"'; $result = $this->_db_connector->performQuery($query); if (!isset($result) or !$result) { include_once 'functions/error_functions.php'; trigger_error('Problems updating label: "' . $this->_dberror . '" from query: "' . $query . '"', E_USER_WARNING); } }
/** update a section - internal, do not use -> use method save * this method updates the database record for a given section item * * @param cs_section_item the section item for which an update should be made * @param bool can disable setting of new modification date */ function _update($item) { $date_string = ''; if (!$this->_save_section_without_date) { parent::_update($item); $date_string = 'modification_date="' . getCurrentDateTimeInMySQL() . '",'; } $modificator_item = $item->getModificatorItem(); if (!isset($modificator_item)) { $modificator_item = $this->_environment->getCurrentUserItem(); } $query = 'UPDATE ' . $this->addDatabasePrefix('section') . ' SET ' . $date_string . 'title="' . encode(AS_DB, $item->getTitle()) . '",' . 'number="' . encode(AS_DB, $item->getNumber()) . '",' . 'description="' . encode(AS_DB, $item->getDescription()) . '",' . 'material_item_id="' . encode(AS_DB, $item->getLinkedItemID()) . '",' . 'modifier_id="' . encode(AS_DB, $modificator_item->getItemID()) . '"' . ' WHERE item_id="' . encode(AS_DB, $item->getItemID()) . '"' . ' AND version_id="' . encode(AS_DB, $item->getVersionID()) . '"'; // extras (TBD) $result = $this->_db_connector->performQuery($query); if (!isset($result) or !$result) { include_once 'functions/error_functions.php'; trigger_error('Problems updating section from query: "' . $query . '"', E_USER_WARNING); } $this->_save_section_without_date = false; //restore default unset($item); }
/** update a discussion - internal, do not use -> use method save * this method updates a discussion * * @param object cs_item discussion_item the discussion */ function _update($discussionarticle_item) { if ($this->_update_with_changing_modification_information) { parent::_update($discussionarticle_item); } $this->_current_article_modification_date = getCurrentDateTimeInMySQL(); $this->_current_article_id = $discussionarticle_item->getItemID(); $query = 'UPDATE ' . $this->addDatabasePrefix('discussionarticles') . ' SET '; if ($this->_update_with_changing_modification_information) { $query .= 'modification_date="' . $this->_current_article_modification_date . '",'; } $query .= 'subject="' . encode(AS_DB, $discussionarticle_item->getSubject()) . '",' . 'description="' . encode(AS_DB, $discussionarticle_item->getDescription()) . '",' . 'position="' . encode(AS_DB, $discussionarticle_item->getPosition()) . '"'; if ($this->_update_with_changing_modification_information) { $query .= ', modifier_id="' . encode(AS_DB, $this->_current_user->getItemID()) . '"'; } $query .= ' WHERE item_id="' . encode(AS_DB, $discussionarticle_item->getItemID()) . '"'; $result = $this->_db_connector->performQuery($query); if (!isset($result) or !$result) { include_once 'functions/error_functions.php'; trigger_error('Problems updating discussionarticle item: "' . $this->_dberror . '" from query: "' . $query . '"', E_USER_WARNING); } unset($discussionarticle_item); }
/** update an auth_source - internal, do not use -> use method save * this method updates an auth_source * * @param object cs_item item the auth_source */ function _update($item) { parent::_update($item); $modificator = $item->getModificatorItem(); $current_datetime = getCurrentDateTimeInMySQL(); if ($item->isPublic()) { $public = '1'; } else { $public = '0'; } $query = 'UPDATE auth_source SET ' . 'modifier_id="' . encode(AS_DB, $modificator->getItemID()) . '",' . 'modification_date="' . $current_datetime . '",' . 'title="' . encode(AS_DB, $item->getTitle()) . '",' . 'extras="' . encode(AS_DB, serialize($item->getExtraInformation())) . '"' . ' WHERE item_id="' . encode(AS_DB, $item->getItemID()) . '"'; $result = $this->_db_connector->performQuery($query); if (!isset($result) or !$result) { include_once 'functions/error_functions.php'; trigger_error('Problems updating auth_source.', E_USER_WARNING); } unset($item); }
/** update a material - internal, do not use -> use method save * this method updates a material * * @param object cs_item material_item the material */ function _update($material_item) { parent::_update($material_item); $modificator = $material_item->getModificatorItem(); if (!isset($modificator)) { include_once 'functions/error_functions.php'; trigger_error('Problems creating new material: Modificator is not set', E_USER_ERROR); } else { $public = $material_item->isPublic() ? '1' : '0'; $copy_id = NULL; $copy_item = $material_item->getCopyItem(); if (isset($copy_item)) { $copy_id = $copy_item->getItemID(); } else { $copy_id = '0'; } if ($material_item->getWorldPublic()) { $world_public = $material_item->getWorldPublic(); } else { $world_public = '0'; } $modification_date = getCurrentDateTimeInMySQL(); if ($material_item->isNotActivated()) { $modification_date = $material_item->getModificationDate(); } $query = 'UPDATE ' . $this->addDatabasePrefix('materials') . ' SET ' . 'modification_date="' . $modification_date . '",' . 'modifier_id="' . encode(AS_DB, $modificator->getItemID()) . '",' . 'title="' . encode(AS_DB, $material_item->getTitle()) . '",' . 'description="' . encode(AS_DB, $material_item->getDescription()) . '",' . 'publishing_date="' . encode(AS_DB, $material_item->getPublishingDate()) . '",' . 'author="' . encode(AS_DB, $material_item->getAuthor()) . '",' . 'public="' . encode(AS_DB, $public) . '",' . 'world_public="' . encode(AS_DB, $world_public) . '",' . 'copy_of="' . encode(AS_DB, $copy_id) . '",' . 'extras="' . encode(AS_DB, serialize($material_item->getExtraInformation())) . '",' . 'workflow_status="' . encode(AS_DB, $material_item->getWorkflowTrafficLight()) . '",' . 'workflow_resubmission_date="' . encode(AS_DB, $material_item->getWorkflowResubmissionDate()) . '",' . 'workflow_validity_date="' . encode(AS_DB, $material_item->getWorkflowValidityDate()) . '"' . ' WHERE item_id="' . encode(AS_DB, $material_item->getItemID()) . '"' . ' AND version_id="' . encode(AS_DB, $material_item->getVersionID()) . '"'; $result = $this->_db_connector->performQuery($query); if (!isset($result) or !$result) { include_once 'functions/error_functions.php'; trigger_error('Problems updating material from query: "' . $query . '"', E_USER_WARNING); } } }
/** update a todo - internal, do not use -> use method save * this method updates the database record for a given todo item * * @param cs_todo_item the todo item for which an update should be made */ function _update($item) { parent::_update($item); $modificator = $item->getModificatorItem(); $modification_date = getCurrentDateTimeInMySQL(); if ($item->isPublic()) { $public = '1'; } else { $public = '0'; } if ($item->isNotActivated()) { $modification_date = $item->getModificationDate(); } $query = 'UPDATE ' . $this->addDatabasePrefix('todos') . ' SET ' . 'modifier_id="' . encode(AS_DB, $modificator->getItemID()) . '",' . 'modification_date="' . $modification_date . '",' . 'title="' . encode(AS_DB, $item->getTitle()) . '",' . 'date="' . encode(AS_DB, $item->getDate()) . '",' . 'status="' . encode(AS_DB, $item->getInternalStatus()) . '",' . 'minutes="' . encode(AS_DB, $item->getPlannedTime()) . '",' . 'time_type="' . encode(AS_DB, $item->getTimeType()) . '",' . 'public="' . encode(AS_DB, $public) . '",' . 'description="' . encode(AS_DB, $item->getDescription()) . '"' . ' WHERE item_id="' . encode(AS_DB, $item->getItemID()) . '"'; // extras (TBD) $result = $this->_db_connector->performQuery($query); if (!isset($result) or !$result) { include_once 'functions/error_functions.php'; trigger_error('Problems updating todos from query: "' . $query . '"', E_USER_WARNING); } }
/** update a user - internal, do not use -> use method save * this method updates a user * * @param object cs_item user_item the user */ function _update($user_item, $with_creator_id = false) { parent::_update($user_item); $query = 'UPDATE ' . $this->addDatabasePrefix('user') . ' SET '; if ($user_item->isChangeModificationOnSave()) { $modificator = $user_item->getModificatorItem(); if (isset($modificator)) { $modifier_id = $modificator->getItemID(); if (!empty($modifier_id)) { $query .= 'modifier_id="' . encode(AS_DB, $modifier_id) . '",'; } unset($modificator); } $query .= 'modification_date="' . encode(AS_DB, getCurrentDateTimeInMySQL()) . '",'; } $contact_status = $user_item->getContactStatus(); if (empty($contact_status)) { $contact_status = 0; } $query .= 'context_id="' . encode(AS_DB, $user_item->getContextID()) . '",'; $query .= 'status="' . encode(AS_DB, $user_item->getStatus()) . '",'; $query .= 'is_contact="' . encode(AS_DB, $contact_status) . '",'; $query .= 'user_id="' . encode(AS_DB, $user_item->getUserID()) . '",'; $query .= 'auth_source="' . $user_item->getAuthSource() . '",'; $query .= 'firstname="' . encode(AS_DB, $user_item->getFirstname()) . '",'; $query .= 'lastname="' . encode(AS_DB, $user_item->getLastname()) . '",'; $query .= 'email="' . encode(AS_DB, $user_item->getEmail()) . '",'; $query .= 'city="' . encode(AS_DB, $user_item->getCity()) . '",'; $query .= 'visible="' . encode(AS_DB, $user_item->getVisible()) . '",'; $query .= 'description="' . encode(AS_DB, $user_item->getDescription()) . '",'; // Datenschutz $expire_date = $user_item->getPasswordExpireDate(); if (empty($expire_date) or $expire_date == 0) { $query .= 'expire_date=NULL,'; } else { $query .= 'expire_date="' . encode(AS_DB, $expire_date) . '",'; } // if user was entered by system (creator_id == 0) then creator_id must change from 0 to item_id of the user_item // see methode _create() if ($with_creator_id) { $query .= 'creator_id="' . encode(AS_DB, $user_item->getCreatorID()) . '",'; } $query .= "extras='" . encode(AS_DB, serialize($user_item->getExtraInformation())) . "'"; $query .= ' WHERE item_id="' . encode(AS_DB, $user_item->getItemID()) . '"'; $result = $this->_db_connector->performQuery($query); if (!isset($result) or !$result) { include_once 'functions/error_functions.php'; trigger_error('Problems upating user item.', E_USER_ERROR); } else { unset($result); } unset($user_item); }
/** update a room - internal, do not use -> use method save * this method updates a room * * @param object cs_context_item a commsy room */ function _update($item) { if ($this->_update_with_changing_modification_information) { parent::_update($item); } $query = 'UPDATE ' . $this->addDatabasePrefix($this->_db_table) . ' SET '; if ($this->_update_with_changing_modification_information) { $query .= 'modification_date="' . getCurrentDateTimeInMySQL() . '",'; $modifier_id = $this->_current_user->getItemID(); if (!empty($modifier_id)) { $query .= 'modifier_id="' . encode(AS_DB, $modifier_id) . '",'; } } if ($item->isOpenForGuests()) { $open_for_guests = 1; } else { $open_for_guests = 0; } $activity_points = $item->getActivityPoints(); if (empty($activity_points)) { $activity_points = 0; } $query .= 'title="' . encode(AS_DB, $item->getTitle()) . '",' . "context_id='" . encode(AS_DB, $item->getContextID()) . "'," . "extras='" . encode(AS_DB, serialize($item->getExtraInformation())) . "'," . "status='" . encode(AS_DB, $item->getStatus()) . "'," . "activity='" . encode(AS_DB, $activity_points) . "'," . "is_open_for_guests='" . encode(AS_DB, $open_for_guests) . "'"; // maybe move this to method to portal/server manager if ($item->isPortal() or $item->isServer()) { $url = $item->getUrl(); if (isset($url)) { $query .= ", url='" . encode(AS_DB, $url) . "'"; } } $query .= ' WHERE item_id="' . encode(AS_DB, $item->getItemID()) . '"'; $result = $this->_db_connector->performQuery($query); if (!isset($result) or !$result) { include_once 'functions/error_functions.php'; trigger_error('Problems updating ' . $this->_db_table . ' item.', E_USER_WARNING); } unset($item); }