本文整理汇总了PHP中RequestUtil::Get方法的典型用法代码示例。如果您正苦于以下问题:PHP RequestUtil::Get方法的具体用法?PHP RequestUtil::Get怎么用?PHP RequestUtil::Get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RequestUtil
的用法示例。
在下文中一共展示了RequestUtil::Get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Query
/**
* API Method queries for ModeloCertificado records and render as JSON
*/
public function Query()
{
try {
$criteria = new ModeloCertificadoCriteria();
if (RequestUtil::Get('idPalestra')) {
$criteria->IdPalestra_Equals = RequestUtil::Get('idPalestra');
}
// TODO: this will limit results based on all properties included in the filter list
$filter = RequestUtil::Get('filter');
if ($filter) {
$criteria->AddFilter(new CriteriaFilter('IdModeloCertificado,Nome,TextoParticipante,TextoPalestrante,ArquivoCss,Elementos', '%' . $filter . '%'));
}
// TODO: this is generic query filtering based only on criteria properties
foreach (array_keys($_REQUEST) as $prop) {
$prop_normal = ucfirst($prop);
$prop_equals = $prop_normal . '_Equals';
if (property_exists($criteria, $prop_normal)) {
$criteria->{$prop_normal} = RequestUtil::Get($prop);
} elseif (property_exists($criteria, $prop_equals)) {
// this is a convenience so that the _Equals suffix is not needed
$criteria->{$prop_equals} = RequestUtil::Get($prop);
}
}
$output = new stdClass();
// if a sort order was specified then specify in the criteria
$output->orderBy = RequestUtil::Get('orderBy');
$output->orderDesc = RequestUtil::Get('orderDesc') != '';
if ($output->orderBy) {
$criteria->SetOrder($output->orderBy, $output->orderDesc);
}
$page = RequestUtil::Get('page');
if ($page != '') {
// if page is specified, use this instead (at the expense of one extra count query)
$pagesize = $this->GetDefaultPageSize();
$modelocertificados = $this->Phreezer->Query('ModeloCertificadoReporter', $criteria)->GetDataPage($page, $pagesize);
$output->rows = $modelocertificados->ToObjectArray(true, $this->SimpleObjectParams());
$output->totalResults = $modelocertificados->TotalResults;
$output->totalPages = $modelocertificados->TotalPages;
$output->pageSize = $modelocertificados->PageSize;
$output->currentPage = $modelocertificados->CurrentPage;
} else {
// return all results
$modelocertificados = $this->Phreezer->Query('ModeloCertificadoReporter', $criteria);
$output->rows = $modelocertificados->ToObjectArray(true, $this->SimpleObjectParams());
//RETIRA CAMPO PARA ASSINATURA DO PARTICIPANTE SE FOR CERTIFICADO DE PALESTRANTE
if (RequestUtil::Get('palestrante')) {
$regex = '/(class=\\"hide-palestrante)/';
$output->rows[0]->elementos = preg_replace($regex, '$1 hide', $output->rows[0]->elementos);
}
$output->totalResults = count($output->rows);
$output->totalPages = 1;
$output->pageSize = $output->totalResults;
$output->currentPage = 1;
}
$this->RenderJSON($output, $this->JSONPCallback());
} catch (Exception $ex) {
$this->RenderExceptionJSON($ex);
}
}
示例2: Query
/**
* API Method queries for Palestra records and render as JSON
*/
public function Query()
{
try {
$criteria = new PalestraCriteria();
//Filtra pelo evento caso ele exista na URL (e no arquivo js correspondente a esse controller)
$evento = RequestUtil::Get('evento');
if ($evento) {
$criteria->AddFilter(new CriteriaFilter('IdEvento', $evento));
}
// TODO: this will limit results based on all properties included in the filter list
$filter = RequestUtil::Get('filter');
if ($filter) {
$criteria->AddFilter(new CriteriaFilter('IdPalestra,Nome,Data,CargaHoraria,ProprioEvento,IdEvento,IdModeloCertificado', '%' . $filter . '%'));
}
$criteria->Nome_NotEquals = '.';
//PARA NÃO LISTAR AS PALESTRAS COM NOME . QUE SÃO CRIADAS AUTOMATICAMENTE PARA CONTROLE
// TODO: this is generic query filtering based only on criteria properties
foreach (array_keys($_REQUEST) as $prop) {
$prop_normal = ucfirst($prop);
$prop_equals = $prop_normal . '_Equals';
if (property_exists($criteria, $prop_normal)) {
$criteria->{$prop_normal} = RequestUtil::Get($prop);
} elseif (property_exists($criteria, $prop_equals)) {
// this is a convenience so that the _Equals suffix is not needed
$criteria->{$prop_equals} = RequestUtil::Get($prop);
}
}
$output = new stdClass();
// if a sort order was specified then specify in the criteria
$output->orderBy = RequestUtil::Get('orderBy');
$output->orderDesc = RequestUtil::Get('orderDesc') != '';
if ($output->orderBy) {
$criteria->SetOrder($output->orderBy, $output->orderDesc);
}
$page = RequestUtil::Get('page');
if ($page != '') {
// if page is specified, use this instead (at the expense of one extra count query)
$pagesize = $this->GetDefaultPageSize();
$palestras = $this->Phreezer->Query('PalestraReporter', $criteria)->GetDataPage($page, $pagesize);
$output->rows = $palestras->ToObjectArray(true, $this->SimpleObjectParams());
$output->totalResults = $palestras->TotalResults;
$output->totalPages = $palestras->TotalPages;
$output->pageSize = $palestras->PageSize;
$output->currentPage = $palestras->CurrentPage;
} else {
// return all results
$palestras = $this->Phreezer->Query('PalestraReporter', $criteria);
$output->rows = $palestras->ToObjectArray(true, $this->SimpleObjectParams());
$output->totalResults = count($output->rows);
$output->totalPages = 1;
$output->pageSize = $output->totalResults;
$output->currentPage = 1;
}
$this->RenderJSON($output, $this->JSONPCallback());
} catch (Exception $ex) {
$this->RenderExceptionJSON($ex);
}
}
示例3: GetConnectionString
/**
* Get connection string based on request variables
*/
protected function GetConnectionString()
{
$cstring = new DBConnectionString();
$cstring->Host = RequestUtil::Get('host');
$cstring->Port = RequestUtil::Get('port');
$cstring->Username = RequestUtil::Get('username');
$cstring->Password = RequestUtil::Get('password');
$cstring->DBName = RequestUtil::Get('schema');
return $cstring;
}
示例4: Login
/**
* Process the login, create the user session and then redirect to
* the appropriate page
*/
public function Login()
{
$user = new ExampleUser();
if ($user->Login(RequestUtil::Get('username'), RequestUtil::Get('password'))) {
// login success
$this->SetCurrentUser($user);
$this->Redirect('SecureExample.UserPage');
} else {
// login failed
$this->Redirect('SecureExample.LoginForm', 'Unknown username/password combination');
}
}
示例5: Login
/**
* Process the login, create the user session and then redirect to
* the appropriate page
*/
public function Login()
{
$user = new User($this->Phreezer);
if ($user->Login(RequestUtil::Get('username'), RequestUtil::Get('password'))) {
// login success
$this->SetCurrentUser($user);
$this->Redirect('Secure.UserPage');
} else {
// login failed
$this->Redirect('Secure.LoginForm', 'Usuario e senha invalidos.');
}
}
示例6: Query
/**
* API Method queries for Usuario records and render as JSON
*/
public function Query()
{
try {
$criteria = new UsuarioCriteria();
$criteria->IdUsuario_GreaterThan = 1;
// para não lista o usuario Master
// TODO: this will limit results based on all properties included in the filter list
$filter = RequestUtil::Get('filter');
if ($filter) {
$criteria->AddFilter(new CriteriaFilter('Nome,Email,Login,TipoUsuario', '%' . $filter . '%'));
}
// TODO: this is generic query filtering based only on criteria properties
foreach (array_keys($_REQUEST) as $prop) {
$prop_normal = ucfirst($prop);
$prop_equals = $prop_normal . '_Equals';
if (property_exists($criteria, $prop_normal)) {
$criteria->{$prop_normal} = RequestUtil::Get($prop);
} elseif (property_exists($criteria, $prop_equals)) {
// this is a convenience so that the _Equals suffix is not needed
$criteria->{$prop_equals} = RequestUtil::Get($prop);
}
}
$output = new stdClass();
// if a sort order was specified then specify in the criteria
$output->orderBy = RequestUtil::Get('orderBy');
$output->orderDesc = RequestUtil::Get('orderDesc') != '';
if ($output->orderBy) {
$criteria->SetOrder($output->orderBy, $output->orderDesc);
}
$page = RequestUtil::Get('page');
if ($page != '') {
// if page is specified, use this instead (at the expense of one extra count query)
$pagesize = $this->GetDefaultPageSize();
$usuarios = $this->Phreezer->Query('Usuario', $criteria)->GetDataPage($page, $pagesize);
$output->rows = $usuarios->ToObjectArray(true, $this->SimpleObjectParams());
$output->totalResults = $usuarios->TotalResults;
$output->totalPages = $usuarios->TotalPages;
$output->pageSize = $usuarios->PageSize;
$output->currentPage = $usuarios->CurrentPage;
} else {
// return all results
$usuarios = $this->Phreezer->Query('Usuario', $criteria);
$output->rows = $usuarios->ToObjectArray(true, $this->SimpleObjectParams());
$output->totalResults = count($output->rows);
$output->totalPages = 1;
$output->pageSize = $output->totalResults;
$output->currentPage = 1;
}
$this->RenderJSON($output, $this->JSONPCallback());
} catch (Exception $ex) {
$this->RenderExceptionJSON($ex);
}
}
示例7: Query
/**
* API Method queries for Media records and render as JSON
*/
public function Query()
{
try {
$criteria = new MediaCriteria();
// TODO: this will limit results based on all properties included in the filter list
$filter = RequestUtil::Get('filter');
if ($filter) {
$criteria->AddFilter(new CriteriaFilter('Idmedia,Idhistory,Storage,Iddocumentation,Institution,Idreference,Mediatype,Mediaurl,Digitizationdate,Digitizationresponsable,Polarity,Colorspace,Iccprofile,Xresolution,Yresolution,Thumbnail,Digitizationequipment,Format,Ispublic,Ordername,Sent,Exif,Textual,Sizemedia,Nameoriginal,Mainmedia,Mediadir,Thumbnaildir,Thumbnailurl', '%' . $filter . '%'));
}
// TODO: this is generic query filtering based only on criteria properties
foreach (array_keys($_REQUEST) as $prop) {
$prop_normal = ucfirst($prop);
$prop_equals = $prop_normal . '_Equals';
if (property_exists($criteria, $prop_normal)) {
$criteria->{$prop_normal} = RequestUtil::Get($prop);
} elseif (property_exists($criteria, $prop_equals)) {
// this is a convenience so that the _Equals suffix is not needed
$criteria->{$prop_equals} = RequestUtil::Get($prop);
}
}
$output = new stdClass();
// if a sort order was specified then specify in the criteria
$output->orderBy = RequestUtil::Get('orderBy');
$output->orderDesc = RequestUtil::Get('orderDesc') != '';
if ($output->orderBy) {
$criteria->SetOrder($output->orderBy, $output->orderDesc);
}
$page = RequestUtil::Get('page');
if ($page != '') {
// if page is specified, use this instead (at the expense of one extra count query)
$pagesize = $this->GetDefaultPageSize();
$medias = $this->Phreezer->Query('Media', $criteria)->GetDataPage($page, $pagesize);
$output->rows = $medias->ToObjectArray(true, $this->SimpleObjectParams());
$output->totalResults = $medias->TotalResults;
$output->totalPages = $medias->TotalPages;
$output->pageSize = $medias->PageSize;
$output->currentPage = $medias->CurrentPage;
} else {
// return all results
$medias = $this->Phreezer->Query('Media', $criteria);
$output->rows = $medias->ToObjectArray(true, $this->SimpleObjectParams());
$output->totalResults = count($output->rows);
$output->totalPages = 1;
$output->pageSize = $output->totalResults;
$output->currentPage = 1;
}
$this->RenderJSON($output, $this->JSONPCallback());
} catch (Exception $ex) {
$this->RenderExceptionJSON($ex);
}
}
示例8: Query
/**
* API Method queries for PlaceLocation records and render as JSON
*/
public function Query()
{
try {
$criteria = new PlaceLocationCriteria();
// TODO: this will limit results based on all properties included in the filter list
$filter = RequestUtil::Get('filter');
if ($filter) {
$criteria->AddFilter(new CriteriaFilter('Id,Complement,Latituded,Local,Longitude,Number,Otherinformation,Street,Type,Zipcode,City,Country,Institution,State', '%' . $filter . '%'));
}
// TODO: this is generic query filtering based only on criteria properties
foreach (array_keys($_REQUEST) as $prop) {
$prop_normal = ucfirst($prop);
$prop_equals = $prop_normal . '_Equals';
if (property_exists($criteria, $prop_normal)) {
$criteria->{$prop_normal} = RequestUtil::Get($prop);
} elseif (property_exists($criteria, $prop_equals)) {
// this is a convenience so that the _Equals suffix is not needed
$criteria->{$prop_equals} = RequestUtil::Get($prop);
}
}
$output = new stdClass();
// if a sort order was specified then specify in the criteria
$output->orderBy = RequestUtil::Get('orderBy');
$output->orderDesc = RequestUtil::Get('orderDesc') != '';
if ($output->orderBy) {
$criteria->SetOrder($output->orderBy, $output->orderDesc);
}
$page = RequestUtil::Get('page');
if ($page != '') {
// if page is specified, use this instead (at the expense of one extra count query)
$pagesize = $this->GetDefaultPageSize();
$placelocations = $this->Phreezer->Query('PlaceLocation', $criteria)->GetDataPage($page, $pagesize);
$output->rows = $placelocations->ToObjectArray(true, $this->SimpleObjectParams());
$output->totalResults = $placelocations->TotalResults;
$output->totalPages = $placelocations->TotalPages;
$output->pageSize = $placelocations->PageSize;
$output->currentPage = $placelocations->CurrentPage;
} else {
// return all results
$placelocations = $this->Phreezer->Query('PlaceLocation', $criteria);
$output->rows = $placelocations->ToObjectArray(true, $this->SimpleObjectParams());
$output->totalResults = count($output->rows);
$output->totalPages = 1;
$output->pageSize = $output->totalResults;
$output->currentPage = 1;
}
$this->RenderJSON($output, $this->JSONPCallback());
} catch (Exception $ex) {
$this->RenderExceptionJSON($ex);
}
}
示例9: Query
/**
* API Method queries for Physicaldescription records and render as JSON
*/
public function Query()
{
try {
$criteria = new PhysicaldescriptionCriteria();
// TODO: this will limit results based on all properties included in the filter list
$filter = RequestUtil::Get('filter');
if ($filter) {
$criteria->AddFilter(new CriteriaFilter('Id,Item,Apexiso,Arabicpagenumbering,Asaiso,Boundtype,Color,Colorsystem,Columnnumber,Compressionmethod,Contentcolor,Contentextent,Contentfinishing,Contentsubstract,Contenttype,Covercolor,Coverfinishing,Coversubstract,Defaultapplication,Dustjacketcolor,Dustjacketfinishing,Dustjacketsubstract,Endpaper,Exif,Format,Framerate,Hasdustjacket,Hassound,Hasspecialfold,Iscompressed,Lengthtxt,Master,Media,Mediasupport,Movements,Other,Projectionmode,Romanpage,Sizetxt,Soundsystem,Specialfold,Specialpagenumebring,Technique,Timecode,Tinting,Titlepage,Totaltime,Type,Writingformat', '%' . $filter . '%'));
}
// TODO: this is generic query filtering based only on criteria properties
foreach (array_keys($_REQUEST) as $prop) {
$prop_normal = ucfirst($prop);
$prop_equals = $prop_normal . '_Equals';
if (property_exists($criteria, $prop_normal)) {
$criteria->{$prop_normal} = RequestUtil::Get($prop);
} elseif (property_exists($criteria, $prop_equals)) {
// this is a convenience so that the _Equals suffix is not needed
$criteria->{$prop_equals} = RequestUtil::Get($prop);
}
}
$output = new stdClass();
// if a sort order was specified then specify in the criteria
$output->orderBy = RequestUtil::Get('orderBy');
$output->orderDesc = RequestUtil::Get('orderDesc') != '';
if ($output->orderBy) {
$criteria->SetOrder($output->orderBy, $output->orderDesc);
}
$page = RequestUtil::Get('page');
if ($page != '') {
// if page is specified, use this instead (at the expense of one extra count query)
$pagesize = $this->GetDefaultPageSize();
$physicaldescriptions = $this->Phreezer->Query('Physicaldescription', $criteria)->GetDataPage($page, $pagesize);
$output->rows = $physicaldescriptions->ToObjectArray(true, $this->SimpleObjectParams());
$output->totalResults = $physicaldescriptions->TotalResults;
$output->totalPages = $physicaldescriptions->TotalPages;
$output->pageSize = $physicaldescriptions->PageSize;
$output->currentPage = $physicaldescriptions->CurrentPage;
} else {
// return all results
$physicaldescriptions = $this->Phreezer->Query('Physicaldescription', $criteria);
$output->rows = $physicaldescriptions->ToObjectArray(true, $this->SimpleObjectParams());
$output->totalResults = count($output->rows);
$output->totalPages = 1;
$output->pageSize = $output->totalResults;
$output->currentPage = 1;
}
$this->RenderJSON($output, $this->JSONPCallback());
} catch (Exception $ex) {
$this->RenderExceptionJSON($ex);
}
}
示例10: Query
/**
* API Method queries for Itemdescription records and render as JSON
*/
public function Query()
{
try {
$criteria = new ItemdescriptionCriteria();
// TODO: this will limit results based on all properties included in the filter list
$filter = RequestUtil::Get('filter');
if ($filter) {
$criteria->AddFilter(new CriteriaFilter('Id,Item,Abstracttext,Accrual,Appraisaldesstructionschedulling,Arrangement,Broadcastmethod,Era,Fromcorporate,Frompersonal,Geographiccoodnates,Geographicname,Label,Language,Mediapresentation,Movement,Other,Period,Periodicity,Preservationstatus,Scope,Style,Subject,Tableofcontents,Targetaudience,Tocorporate,Topersonal', '%' . $filter . '%'));
}
// TODO: this is generic query filtering based only on criteria properties
foreach (array_keys($_REQUEST) as $prop) {
$prop_normal = ucfirst($prop);
$prop_equals = $prop_normal . '_Equals';
if (property_exists($criteria, $prop_normal)) {
$criteria->{$prop_normal} = RequestUtil::Get($prop);
} elseif (property_exists($criteria, $prop_equals)) {
// this is a convenience so that the _Equals suffix is not needed
$criteria->{$prop_equals} = RequestUtil::Get($prop);
}
}
$output = new stdClass();
// if a sort order was specified then specify in the criteria
$output->orderBy = RequestUtil::Get('orderBy');
$output->orderDesc = RequestUtil::Get('orderDesc') != '';
if ($output->orderBy) {
$criteria->SetOrder($output->orderBy, $output->orderDesc);
}
$page = RequestUtil::Get('page');
if ($page != '') {
// if page is specified, use this instead (at the expense of one extra count query)
$pagesize = $this->GetDefaultPageSize();
$itemdescriptions = $this->Phreezer->Query('Itemdescription', $criteria)->GetDataPage($page, $pagesize);
$output->rows = $itemdescriptions->ToObjectArray(true, $this->SimpleObjectParams());
$output->totalResults = $itemdescriptions->TotalResults;
$output->totalPages = $itemdescriptions->TotalPages;
$output->pageSize = $itemdescriptions->PageSize;
$output->currentPage = $itemdescriptions->CurrentPage;
} else {
// return all results
$itemdescriptions = $this->Phreezer->Query('Itemdescription', $criteria);
$output->rows = $itemdescriptions->ToObjectArray(true, $this->SimpleObjectParams());
$output->totalResults = count($output->rows);
$output->totalPages = 1;
$output->pageSize = $output->totalResults;
$output->currentPage = 1;
}
$this->RenderJSON($output, $this->JSONPCallback());
} catch (Exception $ex) {
$this->RenderExceptionJSON($ex);
}
}
示例11: Query
/**
* API Method queries for Item records and render as JSON
*/
public function Query()
{
try {
$criteria = new ItemCriteria();
// TODO: this will limit results based on all properties included in the filter list
$filter = RequestUtil::Get('filter');
if ($filter) {
$criteria->AddFilter(new CriteriaFilter('Iditem,Holder,Level,Institution,Inventoryid,Uritype,Uri,Keywords,Description,Uidtype,Uid,Class,Type,Iseletronic,Creationdate,Acquisitiondate,Scopecontent,Originalexistence,Originallocation,Repositorycode,Copyexistence,Copylocation,Legalaccess,Accesscondition,Reproductionrights,Reproductionrightsdescription,Itemdate,Publishdate,Publisher,Itematributes,Ispublic,Preliminaryrule,Punctuation,Notes,Otherinformation,Idfather,Titledefault,Subitem,Deletecomfirm,Typeitem,Edition,Isexposed,Isoriginal,Ispart,Haspart,Ispartof,Numberofcopies,Tobepublicin,Creationdateattributed,Itemdateattributed,Publishdateattributed,Serachdump,Itemmediadir', '%' . $filter . '%'));
}
// TODO: this is generic query filtering based only on criteria properties
foreach (array_keys($_REQUEST) as $prop) {
$prop_normal = ucfirst($prop);
$prop_equals = $prop_normal . '_Equals';
if (property_exists($criteria, $prop_normal)) {
$criteria->{$prop_normal} = RequestUtil::Get($prop);
} elseif (property_exists($criteria, $prop_equals)) {
// this is a convenience so that the _Equals suffix is not needed
$criteria->{$prop_equals} = RequestUtil::Get($prop);
}
}
$output = new stdClass();
// if a sort order was specified then specify in the criteria
$output->orderBy = RequestUtil::Get('orderBy');
$output->orderDesc = RequestUtil::Get('orderDesc') != '';
if ($output->orderBy) {
$criteria->SetOrder($output->orderBy, $output->orderDesc);
}
$page = RequestUtil::Get('page');
if ($page != '') {
// if page is specified, use this instead (at the expense of one extra count query)
$pagesize = $this->GetDefaultPageSize();
$items = $this->Phreezer->Query('Item', $criteria)->GetDataPage($page, $pagesize);
$output->rows = $items->ToObjectArray(true, $this->SimpleObjectParams());
$output->totalResults = $items->TotalResults;
$output->totalPages = $items->TotalPages;
$output->pageSize = $items->PageSize;
$output->currentPage = $items->CurrentPage;
} else {
// return all results
$items = $this->Phreezer->Query('Item', $criteria);
$output->rows = $items->ToObjectArray(true, $this->SimpleObjectParams());
$output->totalResults = count($output->rows);
$output->totalPages = 1;
$output->pageSize = $output->totalResults;
$output->currentPage = 1;
}
$this->RenderJSON($output, $this->JSONPCallback());
} catch (Exception $ex) {
$this->RenderExceptionJSON($ex);
}
}
示例12: Login
/**
* Process the login, create the user session and then redirect to
* the appropriate page
*/
public function Login()
{
$user = new Usuario($this->Phreezer);
if ($user->Login(RequestUtil::Get('username'), RequestUtil::Get('password'))) {
// login success
$this->SetCurrentUser($user);
$_SESSION['nomeUser'] = $this->GetCurrentUser()->Nome;
//se existir uma pagina na url, senão manda para pagina padrao
if ($this->paginaLoginRedirect) {
$pagina = $this->paginaLoginRedirect;
} elseif ($this->GetCurrentUser()->TipoUsuario != '') {
$pagina = 'Default.Home';
}
//$pagina = ;
$this->Redirect($pagina);
} else {
// login failed
$this->Redirect('SecureExample.LoginForm', 'Combinação de usuário ou senha incorretos');
}
}
示例13: Query
/**
* API Method queries for PalestraPalestrante records and render as JSON
*/
public function Query()
{
try {
$criteria = new PalestraPalestranteCriteria();
//Filtra pelo evento caso ele exista na URL (e no arquivo js correspondente a esse controller)
$palestrante_not_in = RequestUtil::Get('idPalestrante');
if ($palestrante_not_in) {
$criteria->AddFilter(new CriteriaFilter('IdPalestrante', $palestrante_not_in));
}
if (RequestUtil::Get('idPalestrante')) {
$criteria->IdPalestrante_Equals = RequestUtil::Get('idPalestrante');
}
if (RequestUtil::Get('temCertificado')) {
$criteria->TemCertificado = RequestUtil::Get('temCertificado');
}
if (RequestUtil::Get('innerJoinCertificado')) {
$criteria->InnerJoinCertificado = RequestUtil::Get('innerJoinCertificado');
}
if (RequestUtil::Get('naoTemCertificado')) {
$criteria->NaoTemCertificado = RequestUtil::Get('naoTemCertificado');
}
if (RequestUtil::Get('orderByNomePalestrante')) {
$criteria->OrderByNomePalestrante = true;
}
if (RequestUtil::Get('limite')) {
$criteria->Limite = RequestUtil::Get('limite');
}
// TODO: this will limit results based on all properties included in the filter list
$filter = RequestUtil::Get('filter');
if ($filter) {
$criteria->AddFilter(new CriteriaFilter('Id,IdPalestrante,IdPalestra,IdCertificado', '%' . $filter . '%'));
}
// TODO: this is generic query filtering based only on criteria properties
foreach (array_keys($_REQUEST) as $prop) {
$prop_normal = ucfirst($prop);
$prop_equals = $prop_normal . '_Equals';
if (property_exists($criteria, $prop_normal)) {
$criteria->{$prop_normal} = RequestUtil::Get($prop);
} elseif (property_exists($criteria, $prop_equals)) {
// this is a convenience so that the _Equals suffix is not needed
$criteria->{$prop_equals} = RequestUtil::Get($prop);
}
}
$output = new stdClass();
// if a sort order was specified then specify in the criteria
$output->orderBy = RequestUtil::Get('orderBy');
$output->orderDesc = RequestUtil::Get('orderDesc') != '';
if ($output->orderBy) {
$criteria->SetOrder($output->orderBy, $output->orderDesc);
}
$page = RequestUtil::Get('page');
if ($page != '') {
// if page is specified, use this instead (at the expense of one extra count query)
$pagesize = $this->GetDefaultPageSize();
$palestrapalestrantes = $this->Phreezer->Query('PalestraPalestranteReporter', $criteria)->GetDataPage($page, $pagesize);
$output->rows = $palestrapalestrantes->ToObjectArray(true, $this->SimpleObjectParams());
$output->totalResults = $palestrapalestrantes->TotalResults;
$output->totalPages = $palestrapalestrantes->TotalPages;
$output->pageSize = $palestrapalestrantes->PageSize;
$output->currentPage = $palestrapalestrantes->CurrentPage;
} else {
// return all results
$palestrapalestrantes = $this->Phreezer->Query('PalestraPalestranteReporter', $criteria);
$output->rows = $palestrapalestrantes->ToObjectArray(true, $this->SimpleObjectParams());
$output->totalResults = count($output->rows);
$output->totalPages = 1;
$output->pageSize = $output->totalResults;
$output->currentPage = 1;
}
$this->RenderJSON($output, $this->JSONPCallback());
} catch (Exception $ex) {
$this->RenderExceptionJSON($ex);
}
}
示例14: RenderErrorJSON
/**
* Output a Json error message to the browser
* @param string $message
* @param array key/value pairs where the key is the fieldname and the value is the error
*/
protected function RenderErrorJSON($message, $errors = null, $exception = null)
{
$err = new stdClass();
$err->success = false;
$err->message = $message;
$err->errors = array();
if ($errors != null) {
foreach ($errors as $key => $val) {
$err->errors[lcfirst($key)] = $val;
}
}
if ($exception) {
$err->stackTrace = explode("\n#", substr($exception->getTraceAsString(), 1));
}
@header('HTTP/1.1 401 Unauthorized');
$this->RenderJSON($err, RequestUtil::Get('callback'));
}
示例15: GetUrlParam
/**
* @inheritdocs
*/
public function GetUrlParam($paramKey, $default = '')
{
// if the route hasn't been requested, then we need to initialize before we can get url params
if ($this->matchedRoute == null) {
$this->GetRoute();
}
$params = $this->GetUrlParams();
$uri = $this->GetUri();
$count = 0;
$routeMap = $this->matchedRoute["key"];
if (isset($this->matchedRoute["params"][$paramKey])) {
$indexLocation = $this->matchedRoute["params"][$paramKey];
return $params[$indexLocation];
} else {
return RequestUtil::Get($paramKey, "");
}
}