当前位置: 首页>>代码示例>>PHP>>正文


PHP Controller::find方法代码示例

本文整理汇总了PHP中Controller::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Controller::find方法的具体用法?PHP Controller::find怎么用?PHP Controller::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Controller的用法示例。


在下文中一共展示了Controller::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: countNotifications

 /**
  * count unread notifications
  * 
  * @access public
  * @return boolean
  * 
  */
 public function countNotifications($notified_id = null)
 {
     if ($notified_id == null) {
         return;
     }
     return $this->_model->find('count', array('conditions' => array('notified_id' => $notified_id, 'read' => '0')));
 }
开发者ID:jefflv,项目名称:phkapa,代码行数:14,代码来源:NotifyComponent.php

示例2: get

 /**
  * Retorna uma lista de usuários
  *
  * @license    http://www.gnu.org/copyleft/gpl.html GPL
  * @author     Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br)
  * @sponsor    Caixa Econômica Federal
  * @author     José Vicente Tezza Jr. 
  * @return     Retorna uma lista de usuários do LDAP
  * @access     public
  * */
 function get($request)
 {
     $response = new Response($request);
     $response->addHeader('Content-type', 'aplication/json');
     $response->code = Response::OK;
     $h = new Hypermedia();
     $c = new Collection($request->resources, 'UsersResource');
     $this->secured();
     try {
         //Executa uma consulta de usuários do LDAP a partir de um determinado atributo e valor
         if (isset($_GET['field']) && isset($_GET['value'])) {
             //recupera os atributos definidos no conceito 'user'
             $map = Config::get('user', 'OpenLDAP.mapping');
             //verifica se o campo(atributo) passado pelo usuário está definido no conceito 'user'
             if (isset($map[$_GET['field']])) {
                 $users = Controller::find(array('concept' => 'user', 'service' => 'OpenLDAP'), false, array('filter' => array('=', $_GET['field'], $_GET['value']), 'notExternal' => true));
             } else {
                 //lança warning no log do Expresso
                 trigger_error("Invalid field (" . $_GET['field'] . ") in the query.", E_USER_WARNING);
                 //formata os atributos LDAP do conceito 'user'
                 $attributes = implode(', ', $map);
                 //Configura o erro na hypermedia
                 $error = new Error();
                 $error->setCode(Response::NOTFOUND);
                 $error->setTitle('UserLDAP not found');
                 $error->setDescription("Invalid field (" . $_GET['field'] . ") in the query. Use of these: " . $attributes);
                 $c->setError($error);
                 $h->setCollection($c);
                 //retorna a hypermedia
                 $response->code = Response::NOTFOUND;
                 $response->body = $h->getHypermedia($request->accept[10][0]);
                 return $response;
             }
         } else {
             //Executa a consulta dos primeiros 20 usuarios do LDAP
             $users = Controller::find(array('concept' => 'user', 'service' => 'OpenLDAP'), false, array('filter' => array('=', 'phpgwAccountType', 'u'), 'limit' => 20, 'notExternal' => true));
         }
         //Se nao foi encontrado usuarios na consulta
         if ($users === false) {
             $error = new Error();
             $error->setCode(Response::NOTFOUND);
             $error->setTitle('UserLDAP not found');
             $error->setDescription('Users not found.');
             $c->setError($error);
             $h->setCollection($c);
             $response->code = Response::NOTFOUND;
             $response->body = $h->getHypermedia($request->accept[10][0]);
             return $response;
         }
         foreach ($users as $value) {
             $d = new Data();
             $i = new Item($request->resources, 'UsersResource', $value['uid']);
             $d->setName('name');
             $d->setValue($value['name']);
             $d->setPrompt('Nome do Usuario');
             $d->setDataType('string');
             $d->setMaxLength('100');
             $d->setMinLength(null);
             $d->setRequired(true);
             $i->addData($d);
             $d = new Data();
             $d->setName('email');
             $d->setValue($value['mail']);
             $d->setPrompt('Email do Usuario');
             $d->setDataType('string');
             $d->setMaxLength('100');
             $d->setMinLength(null);
             $d->setRequired(true);
             $i->addData($d);
             $d = new Data();
             $d->setName('telephoneNumber');
             $d->setValue($value['telephoneNumber']);
             $d->setPrompt('Telefone do Usuario');
             $d->setDataType('string');
             $d->setMaxLength('100');
             $d->setMinLength(null);
             $d->setRequired(true);
             $i->addData($d);
             $d = new Data();
             $d->setName('vacationActive');
             $d->setValue($value['vacationActive']);
             $d->setPrompt('Status da Regra fora de Escritorio');
             $d->setDataType('boolean');
             $d->setMaxLength('10');
             $d->setMinLength(null);
             $d->setRequired(null);
             $i->addData($d);
             $d = new Data();
             $d->setName('vacationInfo');
             $d->setValue($value['vacationInfo']);
//.........这里部分代码省略.........
开发者ID:cjvaz,项目名称:expressomail,代码行数:101,代码来源:UsersResource.php

示例3: get

 /**
  * Retorna um contato compartilhado 
  *
  * @license    http://www.gnu.org/copyleft/gpl.html GPL
  * @author     Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br)
  * @sponsor    Caixa Econômica Federal
  * @author     José Vicente Tezza Jr. 
  * @return     Retorna um contato Compartilhado
  * @access     public
  * */
 function get($request, $id)
 {
     $this->secured();
     $response = new Response($request);
     $response->addHeader('Content-type', 'aplication/json');
     $response->code = Response::OK;
     $h = new Hypermedia();
     $c = new Collection($request->resources, 'SharedGroupResource');
     try {
         //Recupera o contato
         $contact = Controller::find(array('concept' => 'contact'), false, array('filter' => array('=', 'id', $id)));
         if (!$contact) {
             $this->createException($request, $response, Response::NOTFOUND, 'Bad request', 'Resource not found.');
             return $response;
         }
         //Proprietario do contato
         $ownerId = $contact[0]['user'];
         $idS = array(Config::me("uidNumber"));
         $acl = array();
         //Recupera o uidNumber do usuário que compartilhou o grupo com o usuário logado
         $sql = 'SELECT acl_account as "uidNumber", acl_rights as "acl" ' . 'FROM phpgw_acl ' . 'WHERE (acl_location =   \'' . Config::me("uidNumber") . '\' AND acl_appname =  \'contactcenter\' AND acl_account = \'' . $ownerId . '\')';
         $shareds = Controller::service('PostgreSQL')->execResultSql($sql);
         //Verifica o acesso definido para o usuario logado
         $flagContact = false;
         if (!empty($shareds) && $shareds) {
             foreach ($shareds as $s) {
                 array_push($idS, $s['uidNumber']);
                 $acl[$s['uidNumber']] = $this->decodeAcl(decbin($s['acl']));
                 //verifica se o proprietario do contato habilitou o acesso de leitura para o usuario logado
                 if ($s['uidNumber'] == $ownerId && $acl[$s['uidNumber']]['read']) {
                     $flagContact = true;
                 }
             }
         }
         //Se o contato nao esta compartilhado
         if (!$flagContact) {
             $this->createException($request, $response, Response::UNAUTHORIZED, 'unauthorized', 'Resource unauthorized.');
             return $response;
         }
         //Obtem informacoes do proprietario do contato
         $userOwner = Controller::read(array('concept' => 'user', 'service' => 'OpenLDAP'), false, array('filter' => array('=', 'id', $ownerId), 'notExternal' => true));
         if (is_array($userOwner)) {
             $userOwner = $userOwner[0];
         }
         $t = new Template();
         $d = new Data();
         $d->setName('name');
         $d->setValue(null);
         $d->setPrompt('Nome do Contato');
         $d->setDataType('string');
         $d->setMaxLength(100);
         $d->setMinLength(null);
         $d->setRequired(true);
         $t->addData($d);
         $d = new Data();
         $d->setName('email');
         $d->setValue(null);
         $d->setPrompt('Email do Contato');
         $d->setDataType('string');
         $d->setMaxLength(100);
         $d->setMinLength(null);
         $d->setRequired(true);
         $t->addData($d);
         $d = new Data();
         $d->setName('telefone');
         $d->setValue(null);
         $d->setPrompt('Telefone do Contato');
         $d->setDataType('string');
         $d->setMaxLength(100);
         $d->setMinLength(null);
         $d->setRequired(true);
         $t->addData($d);
         $c->setTemplate($t);
         $d = new Data();
         $d->setName('name');
         $d->setValue($contact[0]['name']);
         $d->setPrompt('Nome do Contato');
         $d->setDataType('string');
         $d->setMaxLength('100');
         $d->setMinLength(null);
         $d->setRequired(true);
         $c->addData($d);
         $d = new Data();
         $d->setName('email');
         $d->setValue($contact[0]['email']);
         $d->setPrompt('Email do Contato');
         $d->setDataType('string');
         $d->setMaxLength('100');
         $d->setMinLength(null);
         $d->setRequired(true);
//.........这里部分代码省略.........
开发者ID:cjvaz,项目名称:expressomail,代码行数:101,代码来源:SharedContactResource.php

示例4: define

if (!defined('ROOTPATH')) {
    define('ROOTPATH', dirname(__FILE__) . '/../..');
}
require_once ROOTPATH . '/api/controller.php';
require_once ROOTPATH . '/modules/calendar/constants.php';
require_once ROOTPATH . '/api/parseTPL.php';
use prototype\api\Config;
$target = gmdate('U') - 300 . '000';
$parts = Controller::service('PostgreSQL')->execSql('SELECT part.user_info_id as "user", co.id as "schedulable", co.type_id as "type", co.allDay as "allDay" ,co.dtend as "endTime", co.dtstart as "startTime", co.summary as "summary", co.tzid as "timezone", co.location as "location", al.id as "id" FROM calendar_object as co INNER JOIN calendar_alarm al ON co.id = al.object_id JOIN calendar_participant part  ON part.id = al.participant_id LEFT JOIN calendar_repeat rep ON  rep.object_id = co.id  LEFT JOIN calendar_repeat_occurrence occ ON occ.repeat_id = rep.id WHERE ( al.action_id = \'' . ALARM_MAIL . '\' AND al.sent = \'0\' AND CASE WHEN occ.occurrence > 0 THEN occ.occurrence - al.alarm_offset ELSE co.dtstart - al.alarm_offset END BETWEEN \'' . $target . '\' AND \'' . ($target + 360000) . '\') ');
if (!is_array($parts)) {
    return;
}
$ids = array();
foreach ($parts as $i => $part) {
    ///Montando lista de participantes
    $users = Controller::find(array('concept' => 'participant'), array('user', 'id', 'isExternal'), array('filter' => array('=', 'schedulable', $part['schedulable']), 'deepness' => 1));
    $attList = array();
    foreach ($users as $user) {
        if ($part['user'] === $user['user']['id']) {
            $part['mail'] = $user['user']['mail'];
        }
        $attList[] = $user['user']['name'];
    }
    $timezone = new DateTimeZone('UTC');
    $sTime = new DateTime('@' . (int) ($part['startTime'] / 1000), $timezone);
    $eTime = new DateTime('@' . (int) ($part['endTime'] / 1000), $timezone);
    $timezone = $part['timezone'];
    $sTime->setTimezone(new DateTimeZone($part['timezone']));
    $eTime->setTimezone(new DateTimeZone($part['timezone']));
    $data = array('startDate' => date_format($sTime, 'd/m/Y'), 'startTime' => $part['allDay'] ? '' : date_format($sTime, 'H:i'), 'endDate' => date_format($eTime, 'd/m/Y'), 'endTime' => $part['allDay'] ? '' : date_format($eTime, 'H:i'), 'eventTitle' => $part['summary'], 'eventLocation' => $part['location'], 'timezone' => $timezone, 'participants' => '<UL> <LI> ' . implode('<LI></LI> ', $attList) . '</LI> </UL>');
    Controller::create(array('service' => 'SMTP'), array('body' => parseTPL::load_tpl($data, ROOTPATH . '/modules/calendar/templates/' . ($parts['type'] == '1' ? 'notify_alarm_body.tpl' : 'notify_alarm_body_task.tpl')), 'isHtml' => true, 'subject' => 'Alarme de Calendario', 'from' => $part['mail'], 'to' => $part['mail']));
开发者ID:cjvaz,项目名称:expressomail,代码行数:31,代码来源:alarms.php

示例5: move

 static function move($origem, $destino, $owner)
 {
     $user = Controller::find(array('concept' => 'user', 'service' => 'OpenLDAP'), false, array('filter' => array('=', 'uid', $owner), 'notExternal' => true));
     $owner = $user[0]['id'];
     self::initSessionVars(array('user' => array('uidNumber' => $owner)));
     //Busca as Agendas do usuario
     $sig = Controller::find(array('concept' => 'calendarSignature'), array('user', 'calendar'), array('filter' => array('AND', array('=', 'user', $params['owner']), array('=', 'isOwner', '1'))));
     //TODO: RESGATAR AGENDA
     foreach ($sig as $i => $v) {
         $cal = Controller::read(array('concept' => 'calendar', 'id' => $v['calendar']), array('local'));
         if ($cal['local'] == $origem) {
             Controller::update(array('concept' => 'calendar', 'id' => $v['calendar']), array('local' => $destino));
         }
     }
 }
开发者ID:cjvaz,项目名称:expressomail,代码行数:15,代码来源:DAViCalAdapter.php

示例6: get

 /**
  * Retorna uma lista de usuários
  *
  * @license    http://www.gnu.org/copyleft/gpl.html GPL
  * @author     Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br)
  * @sponsor    Caixa Econômica Federal
  * @author     José Vicente Tezza Jr. 
  * @return     Retorna um usuário do LDAP filtrado pelo atributo 'uid'
  * @access     public
  * */
 function get($request, $id)
 {
     $response = new Response($request);
     $response->addHeader('Content-type', 'aplication/json');
     $response->code = Response::OK;
     $h = new Hypermedia();
     $c = new Collection($request->resources, 'UserResource');
     try {
         $this->secured();
         $user = Controller::find(array('concept' => 'user', 'service' => 'OpenLDAP'), false, array('filter' => array('=', 'uid', $id), 'notExternal' => true));
         //Se nao foi encontrado usuario na consulta
         if ($user === false) {
             $error = new Error();
             $error->setCode(Response::NOTFOUND);
             $error->setTitle('UserLDAP not found');
             $error->setDescription('User not found.');
             $c->setError($error);
             $h->setCollection($c);
             $response->code = Response::NOTFOUND;
             $response->body = $h->getHypermedia($request->accept[10][0]);
             return $response;
         }
         $t = new Template();
         $d = new Data();
         $d->setName('name');
         $d->setValue(null);
         $d->setPrompt('Nome do Usuário');
         $d->setDataType('string');
         $d->setMaxLength(100);
         $d->setMinLength(null);
         $d->setRequired(true);
         $t->addData($d);
         $d = new Data();
         $d->setName('email');
         $d->setValue(null);
         $d->setPrompt('Email do Usuário');
         $d->setDataType('string');
         $d->setMaxLength(100);
         $d->setMinLength(null);
         $d->setRequired(true);
         $t->addData($d);
         $d = new Data();
         $d->setName('telefone');
         $d->setValue(null);
         $d->setPrompt('Telefone do Usuário');
         $d->setDataType('string');
         $d->setMaxLength(100);
         $d->setMinLength(null);
         $d->setRequired(true);
         $t->addData($d);
         $c->setTemplate($t);
         $d = new Data();
         $d->setName('name');
         $d->setValue($user[0]['name']);
         $d->setPrompt('Nome do Usuário');
         $d->setDataType('string');
         $d->setMaxLength('100');
         $d->setMinLength(null);
         $d->setRequired(true);
         $c->addData($d);
         $d = new Data();
         $d->setName('email');
         $d->setValue($user[0]['mail']);
         $d->setPrompt('Email do Usuário');
         $d->setDataType('string');
         $d->setMaxLength('100');
         $d->setMinLength(null);
         $d->setRequired(true);
         $c->addData($d);
         $d = new Data();
         $d->setName('telephoneNumber');
         $d->setValue($user[0]['telephoneNumber']);
         $d->setPrompt('Telefone do Usuário');
         $d->setDataType('string');
         $d->setMaxLength('100');
         $d->setMinLength(null);
         $d->setRequired(true);
         $c->addData($d);
         $l = new Link();
         $l->setHref('');
         $l->setRel('delete');
         $l->setAlt('Remover');
         $l->setPrompt('Remover');
         $l->setRender('link');
         $c->addLink($l);
         $l = new Link();
         $l->setHref('');
         $l->setRel('put');
         $l->setAlt('Atualizar');
         $l->setPrompt('Atualizar');
//.........这里部分代码省略.........
开发者ID:cjvaz,项目名称:expressomail,代码行数:101,代码来源:UserResource.php

示例7: normalizeEvents

 function normalizeEvents($result, $timezones)
 {
     $mySig = Controller::find(array('concept' => 'calendarSignature'), array('calendar'), array('filter' => array('AND', array('=', 'type', '0'), array('=', 'user', Config::me('uidNumber')), array('=', 'isOwner', '0'))));
     $signedCalendars = array();
     if (is_array($mySig)) {
         foreach ($mySig as $v) {
             $tmp = Controller::find(array('concept' => 'calendarToPermission'), array('acl', 'owner'), array('filter' => array('AND', array('=', 'calendar', $v['calendar']), array('=', 'user', Config::me('uidNumber')))));
             $signedCalendars[$v['calendar']] = $tmp[0];
         }
     }
     $date = new DateTime('now', new DateTimeZone('UTC'));
     $DayLigth = array();
     foreach ($result as $i => $v) {
         $currentTimezone = isset($v['calendar']) && isset($timezones[$v['calendar']]) ? $timezones[$v['calendar']] : $v['timezone'];
         $date->setTimestamp((int) ($v['startTime'] / 1000));
         $date->setTimezone(new DateTimeZone($v['timezone']));
         $DayLigth['event']['startTime'] = $date->getTimestamp() + $date->getOffset() . '000';
         $date->setTimezone(new DateTimeZone($currentTimezone));
         $DayLigth['calendar']['startTime'] = $date->getTimestamp() + $date->getOffset() . '000';
         $date->setTimestamp((int) ($v['endTime'] / 1000));
         $date->setTimezone(new DateTimeZone($currentTimezone));
         $DayLigth['event']['endTime'] = $date->getTimestamp() + $date->getOffset() . '000';
         if (isset($v['due']) && $v['due'] != '0') {
             $date->setTimestamp((int) ($v['due'] / 1000));
             $DayLigth['event']['due'] = $date->getTimestamp() + $date->getOffset() . '000';
         } else {
             $DayLigth['event']['due'] = $v['due'];
         }
         $date->setTimezone(new DateTimeZone($currentTimezone));
         $DayLigth['calendar']['endTime'] = $date->getTimestamp() + $date->getOffset() . '000';
         $result[$i]['DayLigth'] = $DayLigth;
         if (isset($v['occurrences']) && count($v['occurrences']) > 0) {
             $date->setTimestamp((int) ($v['startTime'] / 1000));
             $date->setTimezone(new DateTimeZone($currentTimezone));
             foreach ($result[$i]['occurrences'] as &$o) {
                 $o = (int) ($o / 1000) + $date->getOffset() . '000';
             }
         }
         $attend = isset($signedCalendars[$result[$i]['calendar']]) ? Controller::read(array('concept' => 'participant'), null, array('filter' => array('AND', array('=', 'schedulable', $v['id']), array('=', 'user', $signedCalendars[$result[$i]['calendar']]['owner'])))) : Controller::read(array('concept' => 'participant'), null, array('filter' => array('AND', array('=', 'schedulable', $v['id']), array('=', 'user', Config::me('uidNumber')))));
         $result[$i]['unanswered'] = 0;
         if (count($attend) > 0 && !empty($attend)) {
             if (array_key_exists(0, $attend)) {
                 $attend = $attend[0];
             }
             if (isset($signedCalendars[$result[$i]['calendar']])) {
                 //Caso agenda compartilhada verificar tmb se tem compartilhamento de escrita
                 $result[$i]['editable'] = strpos($signedCalendars[$result[$i]['calendar']]['acl'], "w") >= 0 && (strstr($attend['acl'], "w") || strstr($attend['acl'], "o") || $attend['isOrganizer'] == '1') ? 1 : 0;
             } else {
                 $result[$i]['editable'] = strstr($attend['acl'], "w") || strstr($attend['acl'], "o") || $attend['isOrganizer'] == '1' ? 1 : 0;
             }
             if ($attend['status'] == STATUS_UNANSWERED && !isset($signedCalendars[$result[$i]['calendar']])) {
                 $result[$i]['unanswered'] = 1;
             }
         } else {
             $result[$i]['editable'] = $v['type'] == '2' ? 0 : 2;
         }
         if ($v['type'] == 2 && $v['tasks'] > 0) {
             $result[$i]['type'] = 3;
         }
     }
     return $this->toUtf8($result);
 }
开发者ID:cjvaz,项目名称:expressomail,代码行数:62,代码来源:schedules.php

示例8: getRules

 /**
  * Método que recupera as regras do usuário.
  *
  * @license    http://www.gnu.org/copyleft/gpl.html GPL
  * @author     Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br)
  * @sponsor    Caixa Econômica Federal
  * @author     Airton Bordin Junior <airton@prognus.com.br>
  * @author	  Gustavo Pereira dos Santos <gustavo@prognus.com.br>
  * @return     <Regras do usuário>
  * @access     <public>
  */
 public function getRules()
 {
     $this->rules = Controller::find(array('concept' => 'filter'));
     if (!$this->rules) {
         $this->rules = array();
     }
     return $this->rules;
 }
开发者ID:cjvaz,项目名称:expressomail,代码行数:19,代码来源:FilterMapping.php

示例9: quickSearchMail

 function quickSearchMail($params)
 {
     require_once dirname(__FILE__) . '/../../prototype/api/controller.php';
     set_time_limit(270);
     //Aumenta o tempo limit da requisição, em algumas buscas o imap demora para retornar o resultado.
     $return = array();
     $return['folder'] = $params['folder'];
     if (!is_array($params['folder'])) {
         $params['folder'] = array($params['folder']);
     }
     if (!isset($params['sortType'])) {
         $params['sortType'] = 'SORTDATE_REVERSE';
     }
     $params['search'] = mb_convert_encoding($params['search'], 'UTF-8', mb_detect_encoding($params['search'] . 'x', 'UTF-8, ISO-8859-1'));
     $i = 0;
     if (!isset($params['page'])) {
         $params['page'] = 0;
     }
     $end = $this->prefs['max_email_per_page'] * ((int) $params['page'] + 1);
     $ini = $end - $this->prefs['max_email_per_page'];
     $count = 0;
     if (!preg_match('/KEYWORD/i', $params['search'])) {
         $search = $this->parseCriteriaSearchMail($params['search']);
     } else {
         $search = $params['search'];
     }
     foreach ($params['folder'] as $folder) {
         $imap = $this->open_mbox($folder);
         $msgIds = imap_sort($imap, SORTDATE, 1, SE_UID, $search, 'UTF-8');
         $count += count($msgIds);
         foreach ($msgIds as $ii => $v) {
             $msg = imap_headerinfo($imap, imap_msgno($imap, $v));
             $return['msgs'][$i]['from'] = '';
             if (isset($msg->from[0])) {
                 $from = self::formatMailObject($msg->from[0]);
                 $return['msgs'][$i]['from'] = mb_convert_encoding($from['name'] ? $from['name'] : $from['email'], 'UTF-8');
             } else {
                 $return['msgs'][$i]['from'] = '';
             }
             $return['msgs'][$i]['subject'] = ' ';
             $subject = imap_mime_header_decode($msg->subject);
             foreach ($subject as $tmp) {
                 $return['msgs'][$i]['subject'] .= mb_convert_encoding($tmp->text, 'UTF-8', 'UTF-8 , ISO-8859-1');
             }
             if ($_SESSION['phpgw_info']['user']['preferences']['expressoMail']['use_followupflags_and_labels'] == "2") {
                 $filter = array('AND', array('=', 'folderName', $folder), array('=', 'messageNumber', $v));
                 $followupflagged = Controller::find(array('concept' => 'followupflagged', 'folder' => $folder), false, array('filter' => $filter, 'criteria' => array('deepness' => '2')));
                 if (isset($followupflagged[0]['followupflagId'])) {
                     $followupflag = Controller::read(array('concept' => 'followupflag', 'id' => $followupflagged[0]['followupflagId']));
                     $followupflagged[0]['followupflag'] = $followupflag;
                     $return['msgs'][$i]['followupflagged'] = $followupflagged[0];
                 }
                 $labeleds = Controller::find(array('concept' => 'labeled'), false, array('filter' => $filter, 'criteria' => array('deepness' => '2')));
                 if (is_array($labeleds)) {
                     foreach ($labeleds as $e) {
                         $labels = Controller::read(array('concept' => 'label', 'id' => $e['labelId']));
                         $return['msgs'][$i]['labels'][$e['labelId']] = $labels;
                     }
                 }
             }
             // os comandos abaixos foram retirados pois deixam a busca lenta.
             // $mimeBody = imap_body( $this->mbox, $v  , FT_UID|FT_PEEK  );
             // $return['msgs'][$i]['flag'] .= ( preg_match('/((Content-Disposition:(.)*([\r\n\s]*filename))|(Content-Type:(.)*([\r\n\s]*name)))/i', $mimeBody) ) ? 'T': '';         //
             $return['msgs'][$i]['flag'] = ' ';
             $return['msgs'][$i]['flag'] .= $msg->Unseen ? $msg->Unseen : '';
             $return['msgs'][$i]['flag'] .= $msg->Recent ? $msg->Recent : '';
             $return['msgs'][$i]['flag'] .= $msg->Draft ? $msg->Draft : '';
             $return['msgs'][$i]['flag'] .= $msg->Answered ? $msg->Answered : '';
             $return['msgs'][$i]['flag'] .= $msg->Deleted ? $msg->Deleted : '';
             $msgComponents = new message_components($this->mbox);
             $msgComponents->fetch_structure($v);
             $return['msgs'][$i]['flag'] .= count($msgComponents->fname[$v]) > 0 ? 'T' : '';
             $header = imap_fetchheader($imap, $v, FT_UID);
             // Necessario para recuperar se a mensagem é importante ou não.
             $importante = array();
             if ($msg->Flagged != 'F') {
                 $return['msgs'][$i]['flag'] .= preg_match('/importance\\s{0,}:\\s{0,}(high).*/i', $header, $importante) === 0 ? '' : 'F';
             } else {
                 $return['msgs'][$i]['flag'] .= $msg->Flagged ? $msg->Flagged : '';
             }
             $return['msgs'][$i]['udate'] = gmdate("d/m/Y", $msg->udate + $this->functions->CalculateDateOffset());
             $return['msgs'][$i]['udatecomp'] = substr($return['msgs'][$i]['udate'], -4) . "-" . substr($return['msgs'][$i]['udate'], 3, 2) . "-" . substr($return['msgs'][$i]['udate'], 0, 2);
             $return['msgs'][$i]['date'] = $msg->udate;
             $return['msgs'][$i]['size'] = $msg->Size;
             $return['msgs'][$i]['boxname'] = $folder;
             $return['msgs'][$i]['uid'] = $v;
             ++$i;
         }
     }
     $return['num_msgs'] = $count;
     if (!isset($return['msgs'])) {
         $return['msgs'] = array();
     }
     define('SORTBOX', 69);
     define('SORTWHO', 2);
     define('SORTBOX_REVERSE', 69);
     define('SORTWHO_REVERSE', 2);
     define('SORTDATE_REVERSE', 0);
     define('SORTSUBJECT_REVERSE', 3);
     define('SORTSIZE_REVERSE', 6);
//.........这里部分代码省略.........
开发者ID:cjvaz,项目名称:expressomail,代码行数:101,代码来源:class.imap_functions.inc.php

示例10: getOrganizer

 /**
  * Resgata o organizador do evento
  *
  * @license    http://www.gnu.org/copyleft/gpl.html GPL
  * @author     Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br)
  * @sponsor    Caixa Econômica Federal
  * @author     Cristiano Corrêa Schmidt
  * @access     public
  */
 protected static function getOrganizer(&$schedulable)
 {
     $f = Controller::find(array('concept' => 'participant'), false, array('deepness' => '1', 'filter' => array('AND', array('=', 'schedulable', $schedulable), array('=', 'isOrganizer', '1'))));
     return isset($f[0]) ? $f[0] : false;
 }
开发者ID:cjvaz,项目名称:expressomail,代码行数:14,代码来源:Helpers.php

示例11: verifyNameLabel

 public function verifyNameLabel(&$uri, &$params, &$criteria, $original)
 {
     $labels = Controller::find(array('concept' => 'label'), false, array('filter' => array('i=', 'name', $params['name'])));
     if (!empty($labels)) {
         foreach ($labels as $i => $v) {
             if (!isset($params['id']) || $v['id'] != $params['id']) {
                 throw new Exception('#LabelNameError');
             }
         }
     }
 }
开发者ID:cjvaz,项目名称:expressomail,代码行数:11,代码来源:Helpers.php

示例12: commitParticipant

 /**
  * Analisa o commit do conceito participant e encaminha cada participant para seu devido metodo de notrificação
  *
  * @license    http://www.gnu.org/copyleft/gpl.html GPL
  * @author     Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br)
  * @sponsor    Caixa Econômica Federal
  * @author     Cristiano Corrêa Schmidt
  * @return     void
  * @access     public
  */
 public function commitParticipant(&$uri, &$result, &$data, $original)
 {
     if (Config::regGet('noAlarm') !== false) {
         return;
     }
     //Escapa notificações caso a flag de noAlarm esteja ativa.
     $organizers = array();
     //Cache Organizadores
     $schedulables = array();
     //Cache Schedulables
     foreach ($data as $i => $concept) {
         if ($concept['concept'] === 'participant') {
             if ($concept['method'] == 'create') {
                 $created[] = $concept['id'];
             } else {
                 if ($concept['method'] == 'update') {
                     $updated[] = $concept['id'];
                 }
             }
         } else {
             if ($concept['concept'] === 'schedulable') {
                 //Caso exista schedulable no commit antecipa o carregamento do owner
                 $schedulables[$concept['id']] = Controller::read(array('concept' => 'schedulable', 'id' => $concept['id']), false, array('deepness' => '2'));
                 foreach ($schedulables[$concept['id']]['participants'] as $i => $v) {
                     //salva em $organizers as informações do organizador
                     if ($v['isOrganizer'] === '1' && ($organizers[$concept['id']] = $v)) {
                         break;
                     }
                 }
             } else {
                 if ($concept['concept'] === 'schedulableToAttachment') {
                     $relationAttachment = Controller::find(array('concept' => 'schedulableToAttachment'), false, array('filter' => array('=', 'id', $concept['id'])));
                     foreach ($relationAttachment as $key => $value) {
                         if (!array_key_exists('attachments', $schedulables[$value['schedulable']])) {
                             $schedulables[$value['schedulable']]['attachments'] = array();
                         }
                         $temp = Controller::find(array('concept' => 'attachment'), false, array('filter' => array('=', 'id', $value['attachment'])));
                         array_push($schedulables[$value['schedulable']]['attachments'], $temp[0]);
                     }
                 }
             }
         }
     }
     if (isset($created)) {
         $psCreated = Controller::find(array('concept' => 'participant'), false, array('deepness' => '1', 'filter' => array('IN', 'id', $created)));
         foreach ($psCreated as $i => $pCreated) {
             if ($pCreated['isOrganizer'] == '1' && $pCreated['delegatedFrom'] == '0') {
                 continue;
             }
             //escapa organizador
             $schedulable = isset($schedulables[$pCreated['schedulable']]) ? $schedulables[$pCreated['schedulable']] : Controller::read(array('concept' => 'schedulable', 'id' => $pCreated['schedulable']), false, array('deepness' => '2'));
             if (!self::futureEvent($schedulable['startTime'], $schedulable['rangeEnd'], $schedulable['id'])) {
                 continue;
             }
             //Escapa eventos do passado
             $organizer = isset($organizers[$pCreated['schedulable']]) ? $organizers[$pCreated['schedulable']] : self::getOrganizer($pCreated['schedulable']);
             if ($pCreated['delegatedFrom'] != 0) {
                 self::participantDelegated($pCreated, $schedulable, $organizer);
                 continue;
             }
             switch ($pCreated['status']) {
                 case STATUS_CONFIRMED:
                     self::participantStatusChange($pCreated['id'], $schedulable, $organizer, STATUS_ACCEPTED);
                     break;
                 case STATUS_UNANSWERED:
                     self::participantCreated($pCreated['id'], $schedulable, false, false, $organizer);
                     break;
             }
         }
     }
     if (isset($updated)) {
         $psUpdated = Controller::find(array('concept' => 'participant'), false, array('deepness' => '1', 'filter' => array('IN', 'id', $updated)));
         foreach ($psUpdated as $i => $pUpdated) {
             if ($pUpdated['isOrganizer'] == '1' && $pUpdated['delegatedFrom'] == '0') {
                 continue;
                 //escapa organizador
             }
             $schedulable = isset($schedulables[$pUpdated['schedulable']]) ? $schedulables[$pUpdated['schedulable']] : Controller::read(array('concept' => 'schedulable', 'id' => $pUpdated['schedulable']), false, array('deepness' => '2'));
             if (!self::futureEvent($schedulable['startTime'], $schedulable['rangeEnd'], $schedulable['id'])) {
                 continue;
             }
             //Escapa eventos do passado
             foreach ($schedulable['participants'] as $i => $v) {
                 //salva em $organizer as informações do organizador
                 if ($v['isOrganizer'] === '1' && ($organizer = $v)) {
                     break;
                 }
             }
             if ($pUpdated['delegatedFrom'] != '0') {
                 self::participantDelegatedStatusChange($pUpdated, $schedulable, $organizer, $pUpdated['status']);
//.........这里部分代码省略.........
开发者ID:cjvaz,项目名称:expressomail,代码行数:101,代码来源:Notifications.php

示例13: isAllowDeleteInCalendar

 protected static function isAllowDeleteInCalendar($calendar)
 {
     $f = Controller::find(array('concept' => 'calendarToPermission'), false, array('filter' => array('AND', array('=', 'user', Config::me('uidNumber')), array('=', 'calendar', $calendar))));
     return strpos($f[0]['acl'], CALENDAR_ACL_REMOVE) === false ? false : true;
 }
开发者ID:cjvaz,项目名称:expressomail,代码行数:5,代码来源:DBMapping.php

示例14: getToken

 /**
  * Retrieves an access or refresh token.
  * 
  * @param string $token
  * @param bool $refresh
  */
 protected function getToken($token, $isRefresh = true)
 {
     $tokenConcept = $isRefresh ? 'oauthRefreshToken' : 'oauthToken';
     $filter = $isRefresh ? 'refresh_token' : 'oauth_token';
     $res = Controller::find(array('concept' => $tokenConcept), false, array('filter' => array('=', $filter, $token)));
     /*return (!empty($res[0]))? $res[0] : false;*/
     if (!empty($res[0])) {
         return $res[0];
     } else {
         return false;
     }
 }
开发者ID:cjvaz,项目名称:expressomail,代码行数:18,代码来源:OAuth2StorageUserCredential.php

示例15: _existInMyCalendars

 private static function _existInMyCalendars($id, $owner)
 {
     $sig = Controller::find(array('concept' => 'calendarSignature'), array('user', 'calendar', 'isOwner'), array('filter' => array('AND', array('=', 'isOwner', '1'), array('=', 'user', $owner))));
     $sig2 = Controller::find(array('concept' => 'calendarToPermission'), array('calendar'), array('filter' => array('AND', array('*', 'acl', 'w'), array('=', 'user', $owner))));
     $calendars = array();
     if (is_array($sig)) {
         foreach ($sig as $val) {
             $calendars[] = $val['calendar'];
         }
     }
     if (is_array($sig2)) {
         foreach ($sig2 as $val) {
             $calendars[] = $val['calendar'];
         }
     }
     $return = Controller::find(array('concept' => 'calendarToSchedulable'), null, array('filter' => array('AND', array('IN', 'calendar', $calendars), array('=', 'schedulable', $id))));
     return isset($return[0]) ? $return[0]['calendar'] : false;
 }
开发者ID:cjvaz,项目名称:expressomail,代码行数:18,代码来源:iCal.php


注:本文中的Controller::find方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。