Example #1
0
/**
 * Return the session corresponding to the ip adress of the sender
 * 
 * @param string  $addr The ip adress
 * 
 * @param integer $port The port
 * 
 * @return CDicomSession
 */
function getSession($addr, $port)
{
    $dicom_sender = new CDicomSender();
    /** @var CDicomSender[] $dicom_senders */
    $dicom_senders = $dicom_sender->loadMatchingList();
    $dicom_sender = null;
    foreach ($dicom_senders as $_sender) {
        $source = $_sender->getFirstExchangesSources();
        if ($source->host == $addr) {
            $dicom_sender = $_sender;
            break;
        }
    }
    if (!$dicom_sender->_id) {
        return false;
    }
    $session = new CDicomSession();
    $where = array();
    $where["sender_id"] = " = '{$dicom_sender->_id}'";
    $where["status"] = " IS NULL";
    $where["state"] = " != 'Sta13'";
    $where["end_date"] = " IS NULL";
    $session->loadObject($where);
    if (!$session->_id) {
        $session = new CDicomSession($dicom_sender);
    }
    return $session;
}
 * @subpackage DICOM
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
CCanDo::checkRead();
$_date_min = CValue::getOrSession("_date_min", CMbDT::dateTime("-7 day"));
$_date_max = CValue::getOrSession("_date_max", CMbDT::dateTime("+1 day"));
$group_id = CValue::getOrSession("group_id", CGroups::loadCurrent()->_id);
$sender_id = CValue::getOrSession("sender_id");
$receiver_id = CValue::getOrSession("receiver_id");
$status = CValue::getOrSession("status");
$page = CValue::getOrSession("page", 0);
$order_col = CValue::getOrSession("order_col");
$order_way = CValue::getOrSession("order_way");
$session = new CDicomSession();
$where = array();
if ($group_id) {
    $where["group_id"] = " = '{$group_id}'";
}
if ($receiver_id) {
    $where["receiver_id"] = " = '{$receiver_id}'";
}
if ($sender_id) {
    $where["sender_id"] = " = '{$sender_id}'";
}
if ($status) {
    $where["status"] = " = '{$status}'";
}
if ($_date_min && $_date_max) {
    $where["begin_date"] = " BETWEEN '{$_date_min}' AND '{$_date_max}'";