File manager - Edit - /home/missmand/public_html/learning/old/main/couple/tchat.php
Back
<?php /* For licensing terms, see /license.txt */ /** * Model CRUD for couple_tool_tchat * @author Batiste Roger <batiste.roger@live.fr> * @package chamilo.couple */ require_once(api_get_path(SYS_PATH) . 'main/couple/tool.php'); require_once(api_get_path(SYS_PATH) . 'main/couple/model.php'); define('TABLE_TOOL_TCHAT', 'couple_tool_tchat'); /** * Create a tchat entry * @param type $couple_id * @param type $couple_type * @param type $title * @param type $description * @param type $author_user_id * @param type $is_deleted * @param type $is_ok * @return boolean */ function tchat_create ($couple_id, $couple_type, $title, $description, $author_user_id, $is_deleted = null, $is_ok = null) { // Check that booleans are booleans // Create a tool tool_create($couple_id, $couple_type, $title, $description, $author_user_id, $is_deleted, $is_ok); // Create the tchat item $tool_id = tool_get_max_id(); $sql = "INSERT INTO " . TABLE_TOOL_TCHAT . " SET tool_id = '$tool_id'"; return Database::query($sql); } /** * Read tchat entries * @param type $user_id * @return array */ function tchat_read ($user_id, $couple = null) { if (!UserManager::is_user_id_valid($user_id)) return null; // Get couple info for user_id if (empty($couple)) $couple = couple_get_coop_partner($user_id); // Bad fix. TODO : apply the change everywhere so that couple is never set to null, true, false... if (empty($couple)) return null; $couple_type = strtoupper($couple['type']); $couple_id = $couple['couple_id']; // Get the tool $tool = tool_get_tool_for_couple('tchat', $couple_id, $couple_type); foreach ($tool as $key => $t) { $author_info = UserManager::get_user_info_by_id($t['author_user_id']); $tool[$key]['author_name'] = ucfirst($author_info['firstname']); } return $tool; } function tchat_create_form($couple) { // First, try to read all parameters $description = read_param('description'); // Test that these params are correct if ($description) { // React $my_user_id = api_get_user_id(); $title = "type_is_tchat"; return tchat_create($couple['couple_id'], strtoupper($couple['type']), $title, $description, $my_user_id, null, null); } error_throw("Echec de la création. Params : $description"); return false; }
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0 |
proxy
|
phpinfo
|
Settings