public static function getList($paramsSearch = array())
 {
     $paramsDefault = array('limit' => 500, 'offset' => 0);
     $params = array_merge($paramsDefault, $paramsSearch);
     $session = erLhcoreClassAbstract::getSession();
     $q = $session->createFindQuery('erLhAbstractModelEmailTemplate');
     $conditions = array();
     if (isset($params['filter']) && count($params['filter']) > 0) {
         foreach ($params['filter'] as $field => $fieldValue) {
             $conditions[] = $q->expr->eq($field, $q->bindValue($fieldValue));
         }
     }
     if (isset($params['filterin']) && count($params['filterin']) > 0) {
         foreach ($params['filterin'] as $field => $fieldValue) {
             $conditions[] = $q->expr->in($field, $fieldValue);
         }
     }
     if (isset($params['filterlt']) && count($params['filterlt']) > 0) {
         foreach ($params['filterlt'] as $field => $fieldValue) {
             $conditions[] = $q->expr->lt($field, $q->bindValue($fieldValue));
         }
     }
     if (isset($params['filtergt']) && count($params['filtergt']) > 0) {
         foreach ($params['filtergt'] as $field => $fieldValue) {
             $conditions[] = $q->expr->gt($field, $q->bindValue($fieldValue));
         }
     }
     if (count($conditions) > 0) {
         $q->where($conditions);
     }
     $q->limit($params['limit'], $params['offset']);
     $q->orderBy(isset($params['sort']) ? $params['sort'] : 'id ASC');
     $objects = $session->find($q);
     return $objects;
 }
    public static function processInvitation($params)
    {
        $referrer = self::getHost($params['r']);
        $session = erLhcoreClassAbstract::getSession();
        $matchStringURL = '';
        if ($params['l'] != '') {
            $parts = parse_url($params['l']);
            if (isset($parts['path'])) {
                $matchStringURL = $parts['path'];
            }
            if (isset($parts['query'])) {
                $matchStringURL .= '?' . $parts['query'];
            }
        }
        $q = $session->createFindQuery('erLhAbstractModelBrowseOfferInvitation');
        $q->where('active = 1 AND (' . $q->expr->eq('siteaccess', $q->bindValue(erLhcoreClassSystem::instance()->SiteAccess)) . ' OR siteaccess = \'\')
				AND (' . $q->expr->eq('identifier', $q->bindValue($params['identifier'])) . ')
				AND (' . $q->expr->like($session->database->quote(trim($referrer)), 'concat(referrer,\'%\')') . ' OR referrer = \'\')
				AND (' . $q->expr->lOr($q->expr->eq('url', $q->bindValue('')), $q->expr->eq('url', $q->bindValue(trim($matchStringURL))), $q->expr->lAnd($q->expr->eq('is_wildcard', $q->bindValue(1)), $q->expr->like($session->database->quote(trim($matchStringURL)), 'concat(left(url,length(url)-1),\'%\')'))) . ')')->orderBy('priority ASC')->limit(1);
        $messagesToUser = $session->find($q);
        if (!empty($messagesToUser)) {
            return array_shift($messagesToUser);
        }
        return false;
    }
<?php

$ObjectData = erLhcoreClassAbstract::getSession()->load('erLhAbstractModel' . $Params['user_parameters']['identifier'], (int) $Params['user_parameters']['object_id']);
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$mimeType = finfo_file($finfo, $ObjectData->file_path_server) . "\n";
finfo_close($finfo);
header('Content-type: ' . $mimeType);
header('Content-Disposition: attachment; filename="' . $ObjectData->id . '_file_' . $ObjectData->extension . '"');
echo file_get_contents($ObjectData->file_path_server);
exit;
 public function updateThis()
 {
     erLhcoreClassAbstract::getSession()->update($this);
 }
示例#5
0
}
if (isset($_POST['SaveClient']) || isset($_POST['UpdateClient'])) {
    if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token'])) {
        erLhcoreClassModule::redirect();
        exit;
    }
    $Errors = erLhcoreClassAbstract::validateInput($objectData);
    if (count($Errors) == 0) {
        if (method_exists($objectData, 'saveThis')) {
            $objectData->saveThis();
        } else {
            erLhcoreClassAbstract::getSession()->save($objectData);
        }
        if (method_exists($objectData, 'synchronizeAttribute')) {
            $objectData->synchronizeAttribute();
            erLhcoreClassAbstract::getSession()->update($objectData);
        }
        if (isset($_POST['SaveClient'])) {
            erLhcoreClassModule::redirect('abstract/list', '/' . $Params['user_parameters']['identifier']);
            exit;
        }
        if (isset($_POST['UpdateClient'])) {
            erLhcoreClassModule::redirect('abstract/edit', '/' . $Params['user_parameters']['identifier'] . '/' . $objectData->id);
            exit;
        }
    } else {
        $tpl->set('errors', $Errors);
    }
}
$tpl->set('object', $objectData);
$tpl->set('object_trans', $object_trans);
 public function saveOrUpdate()
 {
     erLhcoreClassAbstract::getSession()->saveOrUpdate($this);
 }