function debugSqlToFile() { global $environment; $db_connector = $environment->getDBConnector(); $sql_query_array = $db_connector->getQueryArray(); debugToFile($sql_query_array); }
public function getUserDetails($session_id, $context_id, $item_id) { include_once 'functions/development_functions.php'; if ($this->_isSessionValid($session_id)) { $this->_environment->setSessionID($session_id); $session = $this->_environment->getSessionItem(); $this->_environment->setCurrentContextID($context_id); $user_id = $session->getValue('user_id'); $auth_source_id = $session->getValue('auth_source'); $user_manager = $this->_environment->getUserManager(); $user_item = $user_manager->getItemByUserIDAuthSourceID($user_id, $auth_source_id); $this->_environment->setCurrentUser($user_item); $reader_manager = $this->_environment->getReaderManager(); $noticed_manager = $this->_environment->getNoticedManager(); //$user_manager = $this->_environment->getUserManager(); $user_details_item = $user_manager->getItem($item_id); $xml = "<user_item>\n"; $xml .= "<user_id><![CDATA[" . $user_details_item->getItemID() . "]]></user_id>\n"; $xml .= "<user_title><![CDATA[" . $user_details_item->getFullname() . "]]></user_title>\n"; $xml .= "<user_firstname><![CDATA[" . $user_details_item->getFirstname() . "]]></user_firstname>\n"; $xml .= "<user_name><![CDATA[" . $user_details_item->getLastname() . "]]></user_name>\n"; if ($user_details_item->isEmailVisible()) { $xml .= "<user_email><![CDATA[" . $user_details_item->getEmail() . "]]></user_email>\n"; } $xml .= "<user_phone1><![CDATA[" . $user_details_item->getTelephone() . "]]></user_phone1>\n"; $xml .= "<user_phone2><![CDATA[" . $user_details_item->getCellularphone() . "]]></user_phone2>\n"; $temp_description = $user_details_item->getDescription(); $temp_description = $this->prepareText($temp_description); $xml .= "<discussion_description><![CDATA[" . $temp_description . "]]></discussion_description>\n"; $reader = $reader_manager->getLatestReaderForUserByID($user_details_item->getItemID(), $user_item->getItemID()); if (empty($reader)) { $xml .= "<user_read><![CDATA[new]]></user_read>\n"; } elseif ($reader['read_date'] < $user_details_item->getModificationDate()) { $xml .= "<user_read><![CDATA[changed]]></user_read>\n"; } else { $xml .= "<user_read><![CDATA[]]></user_read>\n"; } if ($user_details_item->mayEdit($user_item)) { $xml .= "<user_edit><![CDATA[edit]]></user_edit>\n"; } else { $xml .= "<user_edit><![CDATA[non_edit]]></user_edit>\n"; } $user_image = $user_details_item->getPicture(); if ($user_image) { #$user_image_handle = fopen('var'); $disc_manager = $this->_environment->getDiscManager(); $user_image_handle = fopen($disc_manager->getFilePath($this->_environment->getCurrentPortalID(), $this->_environment->getCurrentContextID()) . $user_image, 'r'); $user_image_file = fread($user_image_handle, filesize($disc_manager->getFilePath($this->_environment->getCurrentPortalID(), $this->_environment->getCurrentContextID()) . $user_image)); $xml .= "<user_image>\n"; $xml .= "<user_image_data><![CDATA[" . base64_encode($user_image_file) . "]]></user_image_data>\n"; $xml .= "</user_image>\n"; } $xml .= "</user_item>\n"; $xml = $this->_encode_output($xml); $reader = $reader_manager->getLatestReaderForUserByID($user_details_item->getItemID(), $user_item->getItemID()); if (empty($reader) or $reader['read_date'] < $user_details_item->getModificationDate()) { $reader_manager->markRead($user_details_item->getItemID(), 0); } $noticed = $noticed_manager->getLatestNoticedForUserByID($user_details_item->getItemID(), $user_item->getItemID()); if (empty($noticed) or $noticed['read_date'] < $user_details_item->getModificationDate()) { $noticed_manager->markNoticed($user_details_item->getItemID(), 0); } debugToFile($xml); return $xml; } }