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


PHP Data::setValue方法代码示例

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


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

示例1: build

 /**
  * @param $parts
  * @param $value
  * @return Data
  */
 public static function build($parts, $value)
 {
     $data = new Data();
     $data->setPath($parts);
     $data->setValue($value);
     return $data;
 }
开发者ID:label305,项目名称:dug,代码行数:12,代码来源:Data.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, $id)
 {
     $response = new Response($request);
     $response->addHeader('Content-type', 'aplication/json');
     $response->code = Response::OK;
     $h = new Hypermedia();
     $c = new Collection($request->resources, 'PersonalContactResource');
     try {
         $this->secured();
         $contacts = !!$id ? Controller::find(array('concept' => 'contact'), false, array('filter' => array('AND', array('=', 'user', Config::me("uidNumber")), array('=', 'id', $id)))) : Controller::find(array('concept' => 'contact'), false, array('filter' => array('=', 'user', Config::me("uidNumber"))));
         //Se nao foi encontrado contatos na consulta
         if ($contacts === false) {
             $error = new Error();
             $error->setCode(Response::NOTFOUND);
             $error->setTitle('Contacts not found');
             $error->setDescription('Contacts not found.');
             $c->setError($error);
             $h->setCollection($c);
             $response->code = Response::NOTFOUND;
             $response->body = $h->getHypermedia($request->accept[10][0]);
             return $response;
         }
         foreach ($contacts as $value) {
             $i = new Item($request->resources, 'PersonalContactResource', $value['id']);
             $d = new Data();
             $d->setName('name');
             $d->setValue($value['name']);
             $d->setPrompt('Nome do Contato');
             $d->setDataType('string');
             $d->setMaxLength('100');
             $d->setMinLength(null);
             $d->setRequired(true);
             $i->addData($d);
             $d = new Data();
             $d->setName('id');
             $d->setValue($value['id']);
             $d->setPrompt('Id do Contato');
             $d->setDataType('string');
             $d->setMaxLength('100');
             $d->setMinLength(null);
             $d->setRequired(true);
             $i->addData($d);
             $d = new Data();
             $d->setName('email');
             $d->setValue($value['email']);
             $d->setPrompt('Email do Contato');
             $d->setDataType('string');
             $d->setMaxLength('100');
             $d->setMinLength(null);
             $d->setRequired(true);
             $i->addData($d);
             $l = new Link();
             $l->setHref('');
             $l->setRel('delete');
             $l->setAlt('Remover');
             $l->setPrompt('Remover');
             $l->setRender('link');
             $i->addLink($l);
             $l = new Link();
             $l->setHref('');
             $l->setRel('put');
             $l->setAlt('Atualizar');
             $l->setPrompt('Atualizar');
             $l->setRender('link');
             $i->addLink($l);
             $l = new Link();
             $l->setHref('/contact/' . $value['id']);
             $l->setRel('get');
             $l->setAlt('Buscar');
             $l->setPrompt('Buscar');
             $l->setRender('link');
             $i->addLink($l);
             $c->addItem($i);
         }
         $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);
//.........这里部分代码省略.........
开发者ID:cjvaz,项目名称:expressomail,代码行数:101,代码来源:PersonalContactResource.php

示例3: get

 /**
  * Retorna um contato recente 
  *
  * @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 recente
  * @access     public
  * */
 function get($request, $id)
 {
     $this->secured();
     //verificar se a preferencia de contatos dinamicos nao esta ativada
     if (!$this->isEnabledDynamicContacts(Config::me("uidNumber"))) {
         $response = new Response($request);
         $this->createException($request, $response, Response::UNAUTHORIZED, 'Resource unauthorized', 'disabled dynamic contacts preference');
         return $response;
     }
     $response = new Response($request);
     $response->addHeader('Content-type', 'aplication/json');
     $response->code = Response::OK;
     $h = new Hypermedia();
     $c = new Collection($request->resources, 'DynamicContactResource', $id);
     try {
         $dynamicContact = Controller::read(array('concept' => 'dynamicContact'), false, array('filter' => array('AND', array('=', 'owner', Config::me("uidNumber")), array('=', 'id', $id))));
         //Se nao foi encontrado contatos na consulta
         if (!$dynamicContact) {
             $this->createException($request, $response, Response::NOTFOUND, 'Bad request', 'Dynamic Contact not found.');
             return $response;
         }
         //Normaliza dado
         if (is_array($dynamicContact)) {
             $dynamicContact = $dynamicContact[0];
         }
         $t = new Template();
         $d = new Data();
         $d->setName('name');
         $d->setValue(null);
         $d->setPrompt('Nome do Contato Recente');
         $d->setDataType('string');
         $d->setMaxLength(100);
         $d->setMinLength(null);
         $d->setRequired(true);
         $t->addData($d);
         $d = new Data();
         $d->setName('mail');
         $d->setValue(null);
         $d->setPrompt('Email do Contato Recente');
         $d->setDataType('string');
         $d->setMaxLength(100);
         $d->setMinLength(null);
         $d->setRequired(true);
         $t->addData($d);
         $d = new Data();
         $d->setName('number_of_messages');
         $d->setValue(null);
         $d->setPrompt('Quantidade de mensagens enviadas');
         $d->setDataType('integer');
         $d->setMaxLength(100);
         $d->setMinLength(null);
         $d->setRequired(false);
         $t->addData($d);
         $c->setTemplate($t);
         $d = new Data();
         $d->setName('id');
         $d->setValue($dynamicContact['id']);
         $d->setPrompt('Identificador do Contato Recente');
         $d->setDataType('integer');
         $d->setMaxLength(null);
         $d->setMinLength(null);
         $d->setRequired(true);
         $c->addData($d);
         $d = new Data();
         $d->setName('name');
         $d->setValue($dynamicContact['name']);
         $d->setPrompt('Nome do Contato Recente');
         $d->setDataType('string');
         $d->setMaxLength('100');
         $d->setMinLength(null);
         $d->setRequired(true);
         $c->addData($d);
         $d = new Data();
         $d->setName('mail');
         $d->setValue($dynamicContact['mail']);
         $d->setPrompt('Email do Contato Recente');
         $d->setDataType('string');
         $d->setMaxLength('100');
         $d->setMinLength(null);
         $d->setRequired(true);
         $c->addData($d);
         $d = new Data();
         $d->setName('number_of_messages');
         $d->setValue($dynamicContact['number_of_messages']);
         $d->setPrompt('Quantidade de mensagens enviadas');
         $d->setDataType('integer');
         $d->setMaxLength('100');
         $d->setMinLength(null);
         $d->setRequired(false);
         $c->addData($d);
//.........这里部分代码省略.........
开发者ID:cjvaz,项目名称:expressomail,代码行数:101,代码来源:DynamicContactResource.php

示例4: 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

示例5: newOtherData

 protected function newOtherData($year, $value)
 {
     $subgroup = new Subgroup("subgrupo");
     $font = new Font("fonte1");
     $type = new CoffeType("type3", 2);
     $variety = new Variety("variety3", 2);
     $origin = new Country("origin3", 2);
     $destiny = new Country("destiny2", 2);
     $data = new Data($year, $subgroup, $font, $type, $variety, $origin, $destiny);
     $data->setValue($value);
     return $data;
 }
开发者ID:raigons,项目名称:bureauinteligencia,代码行数:12,代码来源:DatacenterTableBuilderTest.php

示例6: syncChildren

 protected function syncChildren($thingName, $member, $parent)
 {
     if (!isset($parent[$member])) {
         throw new DumbassDeveloperException($member . " is not a child member of given parent");
     }
     $channel = Channel::Shopify;
     $children = $parent[$member];
     $parentThing = Thing::loadByAltId($parent["id"]);
     foreach ($children as $child) {
         $id = $child['id'];
         $thingChild = null;
         try {
             $thingChild = Thing::loadByAltId($id);
         } catch (InstanceNotFoundException $ex) {
             //create a thing for the top level product
             $thingChild = new Thing();
             $thingChild->setAltid($id);
             $thingChild->setName($thingName);
             $thingChild->setChannel($channel);
             $thingChild->setThing($parentThing);
             //set the parent of the child thing
             $thingChild->save();
         }
         //all data associated to the child
         $thingData_raw = $thingChild->getData();
         //indexed numerically
         //make array indexed by key
         $thingDatas = array();
         //indexed by key
         foreach ($thingData_raw as $thingData) {
             $thingDatas[$thingData->getKey()] = $thingData;
         }
         foreach ($child as $key => $value) {
             //create a new data if not exist in thingData
             if (!isset($thingDatas[$key])) {
                 $data = new Data();
                 $data->setKey($key);
                 $data->setValue($value);
                 $data->setThing($thingChild);
                 $data->save();
             } else {
                 $dbData = $thingDatas[$key];
                 if ($dbData->getValue() != $value) {
                     $dbData->setValue($value);
                     $dbData->save();
                 }
             }
         }
     }
 }
开发者ID:rajtrivedi2001,项目名称:shopify_app,代码行数:50,代码来源:request.php

示例7: 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

示例8: 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

示例9: listFilteredByOneSubgroup

 private function listFilteredByOneSubgroup($values = false)
 {
     $list = new ArrayIterator();
     $subgroup = new Subgroup('Quantidade Exportada (sc 60kg)', 1);
     $font = new Font("OIC", 1);
     $type = new CoffeType("Verde");
     $variety = new Variety("Arábica");
     $origin = new Country("Brasil");
     $destiny = new Country("USA");
     if (!$values) {
         $list->append(new Data(1990, $subgroup, $font, $type, $variety, $origin, $destiny));
         $list->append(new Data(1991, $subgroup, $font, $type, $variety, $origin, $destiny));
         $list->append(new Data(1992, $subgroup, $font, $type, $variety, $origin, $destiny));
     } else {
         $data = new Data(1990, $subgroup, $font, $type, $variety, $origin, $destiny);
         $data->setValue(200);
         $list->append($data);
         $data = new Data(1991, $subgroup, $font, $type, $variety, $origin, $destiny);
         $data->setValue(100);
         $list->append($data);
         $data = new Data(1992, $subgroup, $font, $type, $variety, $origin, $destiny);
         $data->setValue(300);
         $list->append($data);
     }
     return $list;
 }
开发者ID:raigons,项目名称:bureauinteligencia,代码行数:26,代码来源:StatisticsTest.php

示例10: get

 /**
  * Retorna uma lista de grupos
  *
  * @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     Adrino Coutinho da Silva. 
  * @return     Retorna uma lista de Contatos Dinâmicos, Grupos, Contatos Pessoais, Grupos Compartilhados e Contatos Compartilhados
  * @access     public
  * */
 function get($request)
 {
     $this->secured();
     //verificar se a preferencia de contatos dinamicos nao esta ativada
     if (!$this->isEnabledDynamicContacts(Config::me("uidNumber"))) {
         $response = new Response($request);
         $this->createException($request, $response, Response::UNAUTHORIZED, 'Resource unauthorized', 'disabled dynamic contacts preference');
         return $response;
     }
     $response = new Response($request);
     $response->addHeader('Content-type', 'aplication/json');
     $response->code = Response::OK;
     $h = new Hypermedia();
     $c = new Collection($request->resources, 'UserContactsResource');
     try {
         $d = new Data();
         $d->setName('User Contacts');
         $d->setValue(null);
         $d->setPrompt('Contatos do usuário');
         $d->setDataType(null);
         $d->setMaxLength(null);
         $d->setMinLength(null);
         $d->setRequired(null);
         $c->addData($d);
         //Recupera os contatos dinâmicos do usuario
         $dynamicContacts = Controller::find(array('concept' => 'dynamicContact'), false, array('filter' => array('=', 'owner', Config::me("uidNumber")), 'order' => array('number_of_messages', 'name', 'mail'), 'orderDesc' => array(true, false, false)));
         if ($dynamicContacts) {
             foreach ($dynamicContacts as $value) {
                 $d = new Data();
                 $i = new Item($request->resources, 'DynamicContactsResource', $value['id']);
                 $d->setName('name');
                 $d->setValue($value['name']);
                 $d->setPrompt('Nome do Contato Recente');
                 $d->setDataType('string');
                 $d->setMaxLength('100');
                 $d->setMinLength(null);
                 $d->setRequired(true);
                 $i->addData($d);
                 $d = new Data();
                 $d->setName('mail');
                 $d->setValue($value['mail']);
                 $d->setPrompt('Email do Contato Recente');
                 $d->setDataType('string');
                 $d->setMaxLength('100');
                 $d->setMinLength(null);
                 $d->setRequired(true);
                 $i->addData($d);
                 $d = new Data();
                 $d->setName('number_of_messages');
                 $d->setValue((int) $value['number_of_messages']);
                 $d->setPrompt('Quantidade de mensagens enviadas');
                 $d->setDataType('integer');
                 $d->setMaxLength('100');
                 $d->setMinLength(null);
                 $d->setRequired(false);
                 $i->addData($d);
                 $d = new Data();
                 $d->setName('id');
                 $d->setValue($value['id']);
                 $d->setPrompt('Id do contato dinamico');
                 $d->setDataType('integer');
                 $d->setMaxLength('100');
                 $d->setMinLength(null);
                 $d->setRequired(false);
                 $i->addData($d);
                 $l = new Link();
                 $l->setHref('');
                 $l->setRel('delete');
                 $l->setAlt('Remover');
                 $l->setPrompt('Remover');
                 $l->setRender('link');
                 $i->addLink($l);
                 $l = new Link();
                 $l->setHref('');
                 $l->setRel('put');
                 $l->setAlt('Atualizar');
                 $l->setPrompt('Atualizar');
                 $l->setRender('link');
                 $i->addLink($l);
                 $l = new Link();
                 $l->setHref('/dynamiccontact/' . $value['id']);
                 $l->setRel('get');
                 $l->setAlt('Buscar');
                 $l->setPrompt('Buscar');
                 $l->setRender('link');
                 $i->addLink($l);
                 $c->addItem($i);
             }
         }
         $idS = array(Config::me("uidNumber"));
//.........这里部分代码省略.........
开发者ID:cjvaz,项目名称:expressomail,代码行数:101,代码来源:UserContactsResource.php

示例11: buildSimpleObjects

 /**
  *
  * @param array $values
  * @return ArrayIterator 
  */
 private function buildSimpleObjects(array $values)
 {
     $list = new ArrayObject();
     foreach ($values as $value) {
         $subgroup = new Subgroup($value['subgroup']);
         $type = new CoffeType($value['type']);
         if ($value['variety'] != null) {
             $variety = new Variety($value['variety']);
         } else {
             $variety = new Variety('-');
         }
         if (isset($value['font'])) {
             $font = new Font($value['font']);
         } else {
             $font = new Font("Todas");
         }
         if (isset($value['origin'])) {
             if ($value['origin'] != null) {
                 $origin = new Country($value['origin']);
             } else {
                 $origin = new Country("-");
             }
         } else {
             $origin = new Country("-");
         }
         if (isset($value['destiny'])) {
             if ($value['destiny'] != null) {
                 $destiny = new Country($value['destiny']);
             } else {
                 $destiny = new Country('-');
             }
         } else {
             $destiny = new Country("-");
         }
         $data = new Data($value['ano'], $subgroup, $font, $type, $variety, $origin, $destiny);
         $data->setValue($value['value']);
         if (isset($value['id'])) {
             $data->setId($value['id']);
         }
         $list->append($data);
     }
     return $list->getIterator();
 }
开发者ID:raigons,项目名称:bureauinteligencia,代码行数:48,代码来源:DatacenterDao.php

示例12: get

 /**
  * Retorna uma lista de contatos recentes 
  *
  * @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 contatos recentes
  * @access     public
  * */
 function get($request)
 {
     $this->secured();
     $response = new Response($request);
     $response->addHeader('Content-type', 'aplication/json');
     $response->code = Response::OK;
     $h = new Hypermedia();
     $c = new Collection($request->resources, 'DynamicContactsResource');
     try {
         $dynamicContacts = Controller::find(array('concept' => 'dynamicContact'), false, array('filter' => array('=', 'owner', Config::me("uidNumber")), 'order' => array('number_of_messages', 'name', 'mail'), 'orderDesc' => array(true, false, false)));
         //Se nao foi encontrado contatos na consulta
         if (!$dynamicContacts) {
             $this->createException($request, $response, Response::NOTFOUND, 'Bad request', 'Dynamic Contact not found.');
             return $response;
         }
         $dynamicContacts = array_slice($dynamicContacts, 0, 50);
         foreach ($dynamicContacts as $value) {
             $d = new Data();
             $i = new Item($request->resources, 'DynamicContactsResource', $value['id']);
             $d->setName('name');
             $d->setValue($value['name']);
             $d->setPrompt('Nome do Contato Recente');
             $d->setDataType('string');
             $d->setMaxLength('100');
             $d->setMinLength(null);
             $d->setRequired(true);
             $i->addData($d);
             $d = new Data();
             $d->setName('mail');
             $d->setValue($value['mail']);
             $d->setPrompt('Email do Contato Recente');
             $d->setDataType('string');
             $d->setMaxLength('100');
             $d->setMinLength(null);
             $d->setRequired(true);
             $i->addData($d);
             $d = new Data();
             $d->setName('number_of_messages');
             $d->setValue($value['number_of_messages']);
             $d->setPrompt('Quantidade de mensagens enviadas');
             $d->setDataType('integer');
             $d->setMaxLength('100');
             $d->setMinLength(null);
             $d->setRequired(false);
             $i->addData($d);
             $d = new Data();
             $d->setName('id');
             $d->setValue($value['id']);
             $d->setPrompt('Id do contato dinamico');
             $d->setDataType('integer');
             $d->setMaxLength('100');
             $d->setMinLength(null);
             $d->setRequired(false);
             $i->addData($d);
             $l = new Link();
             $l->setHref('');
             $l->setRel('delete');
             $l->setAlt('Remover');
             $l->setPrompt('Remover');
             $l->setRender('link');
             $i->addLink($l);
             $l = new Link();
             $l->setHref('');
             $l->setRel('put');
             $l->setAlt('Atualizar');
             $l->setPrompt('Atualizar');
             $l->setRender('link');
             $i->addLink($l);
             $l = new Link();
             $l->setHref('/dynamiccontact/' . $value['id']);
             $l->setRel('get');
             $l->setAlt('Buscar');
             $l->setPrompt('Buscar');
             $l->setRender('link');
             $i->addLink($l);
             $c->addItem($i);
         }
         $t = new Template();
         $d = new Data();
         $d->setName('name');
         $d->setValue(null);
         $d->setPrompt('Nome do Contato Recente');
         $d->setDataType('string');
         $d->setMaxLength(100);
         $d->setMinLength(null);
         $d->setRequired(false);
         $t->addData($d);
         $d = new Data();
         $d->setName('mail');
         $d->setValue(null);
//.........这里部分代码省略.........
开发者ID:cjvaz,项目名称:expressomail,代码行数:101,代码来源:DynamicContactsResource.php

示例13: setValue

 /**
  * Set Value
  * @param type $value
  * @return \Zbase\Ui\PageHeader
  */
 public function setValue($value)
 {
     parent::setValue($value);
     $this->_viewParams['date'] = $value;
     return $this;
 }
开发者ID:claremontdesign,项目名称:zbase,代码行数:11,代码来源:Timestamp.php

示例14: DatacenterService

    CacheCountry::setCacheBehavior(SessionAdmin::getCacheBehavior());
    $cache = CacheCountry::getCountries();

    $service = new DatacenterService($repository, $cache);//$countryMap);
    $statistic = new Statistic();
    $grouper = new DataGrouper();
    $controller = new DatacenterController($service, $statistic, $jsonResponse, $grouper, $factory);     
    return $controller;
}
?>
<?php 
$json = new JsonResponse();
if ($_POST['value'] != null && is_numeric($_POST['value'])) {
    $id_data = $_REQUEST['id_data'];
    $_POST['fromAdmin'] = true;
    $controller = requires($json);
    $value = (double) $_POST['value'];
    $data = new Data(null, null, null, null, null, null, null);
    $data->setId($id_data);
    $data->setValue($value);
    if ($controller->editValue($data)) {
        $message = "Valor alterado com sucesso";
        print_r($json->response(true, $message)->serialize());
    } else {
        $message = "Valor não foi alterado";
        print_r($json->response(false, $message)->serialize());
    }
} else {
    print_r($json->response(false, "O valor deve ser um número válido!")->serialize());
}
开发者ID:raigons,项目名称:bureauinteligencia,代码行数:30,代码来源:edit_value.php

示例15: buildData

 private function buildData($year, $values)
 {
     $data = new Data($year, 1, 1, 1, 1, 1, 1);
     $data->setValue($values);
     return $data;
 }
开发者ID:raigons,项目名称:bureauinteligencia,代码行数:6,代码来源:ServiceTest.php


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