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


PHP AgaviRequestDataHolder::getParameters方法代码示例

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


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

示例1: executeJson

 public function executeJson(AgaviRequestDataHolder $rd)
 {
     try {
         $modules = AgaviConfig::get("org.icinga.modules", array());
         $fileName = $rd->getParameter('template');
         $file = null;
         foreach ($modules as $name => $path) {
             if (file_exists($path . "/config/templates/" . $fileName . '.xml')) {
                 $file = AppKitFileUtil::getAlternateFilename($path . "/config/templates/", $fileName, '.xml');
             }
         }
         if ($file === null) {
             $file = AppKitFileUtil::getAlternateFilename(AgaviConfig::get('modules.cronks.xml.path.grid'), $rd->getParameter('template'), '.xml');
         }
         $template = new CronkGridTemplateXmlParser($file->getRealPath());
         $template->parseTemplate();
         $user = $this->getContext()->getUser()->getNsmUser();
         $data = $template->getTemplateData();
         if ($user->hasTarget('IcingaCommandRestrictions')) {
             $template->removeRestrictedCommands();
         }
         return json_encode(array('template' => $template->getTemplateData(), 'fields' => $template->getFields(), 'keys' => $template->getFieldKeys(), 'params' => $rd->getParameters(), 'connections' => IcingaDoctrineDatabase::$icingaConnections));
     } catch (AppKitFileUtilException $e) {
         $msg = 'Could not find template for ' . $rd->getParameter('template');
         AppKitAgaviUtil::log('Could not find template for ' . $rd->getParameter('template'), AgaviLogger::ERROR);
         return $msg;
     }
 }
开发者ID:philippjenni,项目名称:icinga-web,代码行数:28,代码来源:MetaInformationSuccessView.class.php

示例2: executeWrite

 public function executeWrite(AgaviRequestDataHolder $request_data)
 {
     $parameters = $request_data->getParameters();
     $skeleton_name = $request_data->getParameter('skeleton');
     $target_path = $request_data->getParameter('target_path');
     $type_name = $request_data->getParameter('type');
     // in case of missing custom skeleton validation and missing CLI option, we need to use a default generator
     $skeleton_generator = $request_data->getParameter('skeleton_generator', self::DEFAULT_SKELETON_GENERATOR);
     $parameters['skeleton_generator'] = $skeleton_generator;
     $parameters['reporting_enabled'] = !$request_data->getParameter('quiet');
     try {
         $report = [];
         $report[] = 'Generating skeleton "' . $skeleton_name . '" using generator "' . $skeleton_generator . '".';
         $report[] = 'Generator parameters used are: ';
         $report[] = StringToolkit::getAsString($parameters, true);
         $report[] = '';
         $generator = new $skeleton_generator($skeleton_name, $target_path, $parameters);
         $generator->generate();
         $this->setAttribute('report', array_merge($report, $generator->getReport()));
     } catch (Exception $e) {
         $this->setAttribute('errors', $e->getMessage() . PHP_EOL);
         return 'Error';
     }
     return 'Success';
 }
开发者ID:honeybee,项目名称:honeybee-agavi-cmf-vendor,代码行数:25,代码来源:GenerateCodeAction.class.php

示例3: executeRead

 public function executeRead(AgaviRequestDataHolder $rd)
 {
     $filter = $this->getContext()->getModel("SLA.SLAFilter", "Api");
     $params = $rd->getParameters();
     foreach ($params as $name => $value) {
         switch ($name) {
             case 'starttime':
                 $filter->setStartTime($value);
                 break;
             case 'endtime':
                 $filter->setEndTime($value);
                 break;
             case 'hostsonly':
                 $filter->useOnlyHosts();
                 break;
             case 'timespan':
                 $filter->setTimespan($value);
                 break;
             case 'servicesonly':
                 $filter->useOnlyServices();
                 break;
             case 'instanceIds':
                 $filter->setInstanceIds($value);
                 break;
             case 'hostnames':
                 $filter->setHostnamePattern($value);
                 break;
             case 'servicenames':
                 $filter->setServicenamePattern($value);
                 break;
             case 'hostgroups':
                 $filter->setHostgroupnames($value);
                 break;
             case 'servicegroups':
                 $filter->setServicegroupnames($value);
                 break;
             case 'ids':
                 $filter->setObjectId($value);
                 break;
         }
     }
     $this->addPrincipalsToFilter($filter);
     $stmt = IcingaSlahistoryTable::getSummary(null, $filter);
     $this->setAttribute("result", $stmt);
     return "Success";
 }
开发者ID:philippjenni,项目名称:icinga-web,代码行数:46,代码来源:SLAProviderAction.class.php

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

示例5: updateUserData

 /**
  * Updates the 'simple' userdata
  * @param NsmUser $user
  * @param AgaviRequestDataHolder $rd
  * @return boolean
  * @author Marius Hein
  */
 public function updateUserData(NsmUser &$user, AgaviRequestDataHolder &$rd)
 {
     AppKitDoctrineUtil::updateRecordsetFromArray($user, $rd->getParameters(), self::$editableAttributes);
     if (!$user->get("user_password")) {
         $user->set("user_password", AppKitRandomUtil::initRand());
         $user->set("user_salt", AppKitRandomUtil::initRand());
     }
     // Check the principal. Because we have nothing
     // in some situations #3992
     //
     // Create one of missed here
     if (!$user->principalIsValid()) {
         $principal = new NsmPrincipal();
         $principal->principal_type = NsmPrincipal::TYPE_USER;
         $user->principal = $principal;
     }
     // Manually because we want write empty strings
     $user->set('user_description', $rd->getParameter('user_description', new Doctrine_Null()));
     $user->save();
     return true;
 }
开发者ID:philippjenni,项目名称:icinga-web,代码行数:28,代码来源:UserAdminModel.class.php

示例6: mergeParameters

 /**
  * Merge in parameters from another request data holder.
  *
  * @param      AgaviRequestDataHolder The other request data holder.
  *
  * @author     David Zülke <dz@bitxtender.com>
  * @since      0.11.0
  */
 public function mergeParameters(AgaviRequestDataHolder $other)
 {
     $this->setParameters($other->getParameters());
 }
开发者ID:philippjenni,项目名称:icinga-web,代码行数:12,代码来源:AgaviRequestDataHolder.class.php

示例7: updateRoleData

 /**
  * Updates the simple role data
  * @param NsmRole $role
  * @param AgaviRequestDataHolder $rd
  * @return boolean
  * @author Marius Hein
  */
 public function updateRoleData(NsmRole &$role, AgaviRequestDataHolder &$rd)
 {
     AppKitDoctrineUtil::updateRecordsetFromArray($role, $rd->getParameters(), self::$editableAttributes);
     // Checking the principal
     if (!$role->NsmPrincipal->principal_id) {
         $role->NsmPrincipal->principal_type = NsmPrincipal::TYPE_ROLE;
     }
     if ($role->role_id === null) {
         // insert a new role
         $role->save();
     } else {
         // update role
         $parts = array();
         $params = array();
         foreach ($role as $property => $value) {
             if ($property == "role_id" || !in_array($property, self::$editableAttributes)) {
                 continue;
             }
             if ($value === null) {
                 $parts[] = "{$property} = NULL";
             } else {
                 $parts[] = "{$property} = ? ";
                 $params[] = $value;
             }
         }
         $params[] = $role->role_id;
         $dql = "UPDATE NsmRole SET " . implode(",", $parts) . " WHERE role_id = ?";
         AppKitLogger::warn("Test: %s - %s", $dql, var_export($params, true));
         $query = new Doctrine_Query();
         $query->setConnection(AppKitDoctrineUtil::getConnection());
         $query->parseDqlQuery($dql);
         $query->execute($params);
     }
     return true;
 }
开发者ID:philippjenni,项目名称:icinga-web,代码行数:42,代码来源:RoleAdminModel.class.php


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