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


PHP AgaviRequestDataHolder::setParameter方法代码示例

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


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

示例1: executeHtml

 public function executeHtml(AgaviRequestDataHolder $rd)
 {
     $customViewFields = array("cr_base" => false, "sortField" => false, "sortDir" => false, "groupField" => false, "groupDir" => false, "template" => false, "crname" => false, "filter" => false, "title" => false);
     $requiredViewFields = array("template", "crname", "title");
     $rd->setParameter("isURLView", true);
     foreach ($customViewFields as $name => $val) {
         $val = $rd->getParameter($name, null);
         if ($val == null) {
             if (in_array($name, $requiredViewFields)) {
                 $rd->setParameter("isURLView", false);
                 break;
             } else {
                 unset($customViewFields[$name]);
             }
         } else {
             $customViewFields[$name] = $val;
         }
     }
     if ($rd->getParameter("isURLView")) {
         if (isset($customViewFields["cr_base"]) and trim($customViewFields["cr_base"]) !== "") {
             $this->formatFields($customViewFields);
         }
         $rd->setParameter("URLData", json_encode($customViewFields));
     }
     $this->setupHtml($rd);
     $this->setAttribute('_title', 'Icinga.Cronks.CronkPortal');
 }
开发者ID:philippjenni,项目名称:icinga-web,代码行数:27,代码来源:CronkPortalSuccessView.class.php

示例2: runValidator

 /**
  * @group Validators
  */
 public function runValidator($f, $in)
 {
     $req = new AgaviRequestDataHolder();
     $req->setParameter("input", $in);
     $exec = AgaviContext::getInstance()->getController()->createExecutionContainer();
     $val = $exec->getValidationManager()->createValidator('TestValidator', array("input"), array("invalid_json" => "Invalid json provided", "invalid_format" => "Invalid format"), array("format" => $f, "name" => "test_filter", "base" => NULL, "export" => "test", "source" => "parameters"));
     $val->setValidationParameters($req);
     return $val->validate();
 }
开发者ID:philippjenni,项目名称:icinga-web,代码行数:12,代码来源:AppKitJsonValidatorTest.php

示例3: executeWrite

 public function executeWrite(AgaviRequestDataHolder $rd)
 {
     $params = $rd->getParameters();
     foreach ($params as $key => $param) {
         if (!is_string($param)) {
             continue;
         }
         $json = json_decode($param, true);
         if ($json) {
             $rd->setParameter($key, $json);
         }
     }
     $model = $this->getDataStoreForTarget($params["target"], $rd);
     if (!$model) {
         return "Error";
     }
     $result = $model->execRead();
     $r = $this->getContext()->getModel("Store.DataStoreResult", "Api", array("model" => $model));
     $r->parseResult($result, $rd->getParameter("fields", array()));
     $this->setAttribute("result", $r);
     return $this->getDefaultViewName();
 }
开发者ID:philippjenni,项目名称:icinga-web,代码行数:22,代码来源:ApiDataStoreProviderAction.class.php

示例4: executeWrite

 public function executeWrite(AgaviRequestDataHolder $rd)
 {
     $module = $rd->getParameter("module");
     $action = $rd->getParameter("action");
     $output_type = $rd->getParameter("output_type", "json");
     $dispatchParams = json_decode($rd->getParameter("params"), 1);
     $params = new AgaviRequestDataHolder();
     if (is_array($dispatchParams)) {
         foreach ($dispatchParams as $key => $param) {
             if ($param != null && $param != 'null') {
                 $params->setParameter($key, $param);
             }
         }
     }
     $controller = $this->getContext()->getController();
     $actionInstance = $controller->createActionInstance($module, $action);
     if (!$actionInstance instanceof IAppKitDispatchableAction) {
         $this->setAttribute("error", $module . "." . $action . " is not accessible via the dispatcher");
         return "Error";
     }
     $this->setAttribute("execContainer", $controller->createExecutionContainer($module, $action, $params, $output_type));
     return $this->getDefaultViewName();
 }
开发者ID:philippjenni,项目名称:icinga-web,代码行数:23,代码来源:DispatcherAction.class.php

示例5: executeWrite

 public function executeWrite(AgaviRequestDataHolder $rd)
 {
     $user = $this->getContext()->getUser();
     if ($user->hasCredential('appkit.admin') == false && $user->hasCredential('appkit.admin.groups') == false) {
         throw new AgaviSecurityException("Not Authorized", 401);
     }
     try {
         if ($rd->getParameter("role_parent") == -1) {
             $rd->setParameter("role_parent", null);
         }
         $roleadmin = $this->getContext()->getModel('RoleAdmin', 'AppKit');
         $padmin = $this->getContext()->getModel('PrincipalAdmin', 'AppKit');
         if ($rd->getParameter('id') == 'new') {
             $role = new NsmRole();
         } else {
             $role = $roleadmin->getRoleById($rd->getParameter('id'));
         }
         // Update the basics
         AppKitDoctrineUtil::getConnection()->beginTransaction();
         $roleadmin->updateRoleData($role, $rd);
         if (!$rd->getParameter("ignorePrincipals", false)) {
             $padmin->updatePrincipalValueData($role->NsmPrincipal, $rd->getParameter('principal_target', array()), $rd->getParameter('principal_value', array()));
         }
         AppKitDoctrineUtil::getConnection()->commit();
         if (!$rd->getParameter("ignorePrincipals", false)) {
             $useradmin = $this->getContext()->getModel('UserAdmin', 'AppKit');
             $allUsers = $useradmin->getUsersCollection()->toArray();
             $roleUsers = $rd->getParameter("role_users", array());
             $this->updateUserRoles($allUsers, $role, $useradmin, $roleUsers);
         }
     } catch (Exception $e) {
         $this->setAttribute("error", $e->getMessage());
         try {
             AppKitDoctrineUtil::getConnection()->rollback();
         } catch (Doctrine_Transaction_Exception $e) {
         }
     }
     return 'Success';
 }
开发者ID:philippjenni,项目名称:icinga-web,代码行数:39,代码来源:GroupProviderAction.class.php

示例6: testRoleRemove

 /**
  * @depends testRoleAdd
  * @group Database
  */
 public function testRoleRemove()
 {
     $id = self::$idFixture;
     $this->markTestSkipped("Role delete test doesn't work with transactions yet.");
     try {
         info("\tTesting icinga-web action: Removing roles\n");
         $context = AgaviContext::getInstance();
         $params = new AgaviRequestDataHolder();
         $params->setParameter("group_id", array($id => $id));
         $groupRemoveAction = $context->getController()->createExecutionContainer("AppKit", "Admin.Groups.Remove", $params, null, "write");
         $result = $groupRemoveAction->execute();
         $this->assertNotEquals($result->getHttpStatusCode(), "404", "Action for reading groups not found");
         // Check if group is really deleted
         $result = Doctrine_Core::getTable("NsmRole")->findBy("role_id", $id)->getFirst();
         $this->assertNotType("NsmRole", $result, "Group found despite deleting it, something seemed to go wrong");
         success("\tRemoving role suceeded!\n");
     } catch (Exception $e) {
         $this->fail("Selecting roles failed!" . $e->getMessage());
     }
 }
开发者ID:philippjenni,项目名称:icinga-web,代码行数:24,代码来源:icingaRoleOperations.php

示例7: testCombined

 /**
  * @dataProvider      storeModelProvider
  */
 public function testCombined($model)
 {
     $ctx = AgaviContext::getInstance();
     $req = new AgaviRequestDataHolder();
     $req->setParameter('target', 'IcingaHosts');
     $req->setParameter('fields', 'my.host_object_id,my.display_name,s.display_name');
     $req->setParameter('limit', 5);
     //$req->setParameter('sortfield','my.display_name');
     //$req->setParameter('dir','DESC');
     $req->setParameter('filter_json', array("type" => "OR", "items" => array(array("field" => "my.display_name", "operator" => "=", "value" => "c1-db1"), array("type" => "OR", "items" => array(array("field" => "my.display_name", "operator" => "LIKE", "value" => "%mail%"), array("field" => "display_name", "operator" => "IN", "value" => array("c2-db1")))))));
     $dataStore = $ctx->getModel($model, 'Api', array("request" => $req, "resultType" => "ARRAY"));
     $firstResult = $dataStore->doRead();
     $firstResult = $firstResult["data"];
     $this->assertLessThanOrEqual(5, count($firstResult));
 }
开发者ID:philippjenni,项目名称:icinga-web,代码行数:18,代码来源:IcingaApiDatastoreTest.php

示例8: executeSimple

 /**
  * Execute html within a slot layout only without
  * implementing a new layout method in the corresponding
  * views
  *
  * @param AgaviRequestDataHolder $rd
  * @return mixed
  */
 public function executeSimple(AgaviRequestDataHolder $rd)
 {
     $rd->setParameter('is_slot', true);
     return $this->executeHtml($rd);
 }
开发者ID:philippjenni,项目名称:icinga-web,代码行数:13,代码来源:IcingaBaseView.class.php


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