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


PHP Configuration::save方法代码示例

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


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

示例1: run

 public function run()
 {
     $config = new Configuration();
     $config->name = 'beer_of_the_day_modification_date';
     $config->value = Carbon::now()->format('Y-m-d');
     $config->save();
 }
开发者ID:hopshoppub,项目名称:hopshop.dev,代码行数:7,代码来源:ConfigTableSeeder.php

示例2: add

 public function add($key, $value, $ns = 'conf')
 {
     $config = new Configuration();
     $config->setKey($ns . ':' . $key);
     $config->setValue($value);
     $config->save();
     $this->confTab[$ns][$key] = $value;
     unset($_SESSION['configuration']);
 }
开发者ID:thib3113,项目名称:yana-server,代码行数:9,代码来源:Configuration.class.php

示例3: set

 /**
  * @static
  * @param $name
  * @param $value
  * @return void
  */
 public static function set($name, $value = null)
 {
     $configuration = ConfigurationPeer::retrieveByName($name);
     if (!$configuration) {
         $configuration = new Configuration();
         $configuration->setName($name);
     }
     $configuration->setValue($value);
     $configuration->save();
 }
开发者ID:ratibus,项目名称:Crew,代码行数:16,代码来源:Configuration.php

示例4: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Configuration();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Configuration'])) {
         $model->attributes = $_POST['Configuration'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->_id));
         }
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:bhaiyyalal,项目名称:testcode,代码行数:17,代码来源:ConfigurationController.php

示例5: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $data = Input::all();
     // validate the info, create rules for the inputs
     $rules = array('name' => 'required', 'value' => 'required');
     // run the validation rules on the inputs from the form
     $validator = Validator::make($data, $rules);
     // if the validator fails, redirect back to the form
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput(Input::except('password'));
         // send back the input (not the password) so that we can repopulate the form
     } else {
         $config = new Configuration();
         $config->name = $data['name'];
         $config->value = $data['value'];
         $config->save();
         return Redirect::back()->with('message', 'New configuration parameter added succesfully !');
     }
 }
开发者ID:armannadim,项目名称:restpos,代码行数:24,代码来源:SiteController.php

示例6: beerOfTheDay

 public function beerOfTheDay()
 {
     $dateInDatabase = Configuration::where('name', '=', 'beer_of_the_day_modification_date')->first();
     $date = Carbon::createFromFormat("Y-m-d", "{$dateInDatabase->value}");
     $now = Carbon::now();
     $difference = $now->diffInDays($date);
     if ($difference >= 1) {
         $dateInDatabase->value = $now->format('Y-m-d');
         $dateInDatabase->save();
         $beer = $this->generateRandomBeer();
         $selectedBeer = new Configuration();
         $selectedBeer->name = "beer_id";
         $selectedBeer->value = $beer->beer_id;
         $selectedBeer->save();
     } else {
         $beer = Beer::find(Configuration::where('name', '=', 'beer_id')->orderBy('id', 'desc')->first()->value);
     }
     return View::make('beers.beer-of-the-day')->with(['beer' => $beer]);
 }
开发者ID:hopshoppub,项目名称:hopshop.dev,代码行数:19,代码来源:BeersController.php

示例7: save

 public function save()
 {
     if ($this->perm->can_create == 'y') {
         $data = new Configuration();
         $data->public_status = @$_POST['public_status'] == '' ? 'n' : $_POST['public_status'];
         $data->internal_status = @$_POST['internal_status'] == '' ? 'n' : $_POST['internal_status'];
         if ($_POST['id'] == '') {
             $_POST['created_by'] = $this->current_user->id;
             $_POST['created'] = date("Y-m-d H:i:s");
         } else {
             $_POST['updated_by'] = $this->current_user->id;
             $_POST['updated'] = date("Y-m-d H:i:s");
         }
         $data->from_array($_POST);
         $data->save();
         save_logs($this->menu_id, 'Update', $this->session->userdata("id"), ' Update Configurations ');
     }
     redirect($_SERVER['HTTP_REFERER']);
 }
开发者ID:ultraauchz,项目名称:conference,代码行数:19,代码来源:configurations.php

示例8: processCreate

 protected function processCreate(sfWebRequest $request, ConfigurationForm $form)
 {
     $form->bind($request->getParameter($form->getName()));
     if ($form->isValid()) {
         // Get POST values
         $values = $form->getValues();
         // Create new entry into Project table
         $configurationObject = new Configuration();
         $configurationObject->setImageId($values['image_id']);
         $configurationObject->setTestEnvironmentId($values['test_environment_id']);
         $configurationObject->setProjectToProductId($values['project_to_product_id']);
         $configurationObject->save();
         if ($request->hasParameter('_save_and_add')) {
             $this->getUser()->setFlash('notice', $notice . ' You can add another one below.');
             $this->redirect('@configuration_new');
         } else {
             $this->getUser()->setFlash('notice', $notice);
             $this->redirect(array('sf_route' => 'configuration_edit', 'sf_subject' => $configurationObject));
         }
     } else {
         $this->getUser()->setFlash('error', 'The item has not been saved due to some errors.', false);
     }
 }
开发者ID:alex1818,项目名称:TestReportCenter,代码行数:23,代码来源:actions.class.php

示例9: executeImportRestApi


//.........这里部分代码省略.........
     $conn->beginTransaction();
     // If test_environment_name exists, retrieve id, else, create new entry and retrieve id
     $query = "SELECT te.id AS test_environment_id\n\t\t\t\t\tFROM " . $qa_generic . ".test_environment te\n\t\t\t\t\tWHERE te.name = '" . $get_params['hwproduct'] . "'";
     $result = Doctrine_Manager::getInstance()->getCurrentConnection()->execute($query)->fetch(PDO::FETCH_ASSOC);
     if (empty($result["test_environment_id"])) {
         // Check if creation of a new entry is allowed
         if (sfConfig::get("app_rest_configuration_creation", false) == false) {
             $conn->rollback();
             $conn->setAttribute(Doctrine_Core::ATTR_AUTOCOMMIT, TRUE);
             echo "{\"ok\":\"0\",\"errors\":{\"test_environment\":\"Creation of new test environment is forbidden\"}}\n";
             exit;
         } else {
             // Add new environment
             $environment = new TestEnvironment();
             $environment->setName($get_params['hwproduct']);
             $environment->setNameSlug(MiscUtils::slugify($get_params['hwproduct']));
             // Add hwproduct additional fields if given as parameters
             if (isset($get_params['te_desc'])) {
                 $environment->setDescription($get_params['te_desc']);
             }
             if (isset($get_params['te_cpu'])) {
                 $environment->setCpu($get_params['te_cpu']);
             }
             if (isset($get_params['te_board'])) {
                 $environment->setBoard($get_params['te_board']);
             }
             if (isset($get_params['te_gpu'])) {
                 $environment->setGpu($get_params['te_gpu']);
             }
             if (isset($get_params['te_hw'])) {
                 $environment->setOtherHardware($get_params['te_hw']);
             }
             // Save new environment
             $environment->save($conn);
             $environmentId = $environment->getId();
         }
     } else {
         $environmentId = $result["test_environment_id"];
     }
     // If image_name exists, retrieve id, else, create new entry and retrieve id
     $query = "SELECT i.id AS image_id\n\t\t\t\t\tFROM " . $qa_generic . ".image i\n\t\t\t\t\tWHERE i.name = '" . $get_params['image'] . "'";
     $result = Doctrine_Manager::getInstance()->getCurrentConnection()->execute($query)->fetch(PDO::FETCH_ASSOC);
     if (empty($result["image_id"])) {
         // Check if creation of a new entry is allowed
         if (sfConfig::get("app_rest_configuration_creation", false) == false) {
             $conn->rollback();
             $conn->setAttribute(Doctrine_Core::ATTR_AUTOCOMMIT, TRUE);
             echo "{\"ok\":\"0\",\"errors\":{\"image\":\"Creation of new image is forbidden\"}}\n";
             exit;
         } else {
             // Add new image
             $image = new Image();
             $image->setName($get_params['image']);
             $image->setNameSlug(MiscUtils::slugify($get_params['image']));
             // Add image additional fields if given as parameters
             if (isset($get_params['img_desc'])) {
                 $image->setDescription($get_params['img_desc']);
             }
             if (isset($get_params['img_os'])) {
                 $image->setOs($get_params['img_os']);
             }
             if (isset($get_params['img_dist'])) {
                 $image->setDistribution($get_params['img_dist']);
             }
             if (isset($get_params['img_vers'])) {
                 $image->setVersion($get_params['img_vers']);
开发者ID:alex1818,项目名称:TestReportCenter,代码行数:67,代码来源:actions.class.php

示例10: processEdit

 /**
  * Process the form to edit an existing test session.
  *
  * @param sfWebRequest $request
  * @param SessionForm $form
  */
 protected function processEdit(sfWebRequest $request, SessionForm $form)
 {
     $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
     if ($form->isValid()) {
         $qa_generic = sfConfig::get("app_table_qa_generic");
         // Get sent values and uploaded files
         $values = $form->getValues();
         $files = $request->getFiles();
         // Retrieve values from form
         $projectGroupId = $values["project_group_id"];
         $projectId = $values["project"];
         $productId = $values["product"];
         // Get test environment and image names
         $environmentForm = $form->getValue("environmentForm");
         $imageForm = $form->getValue("imageForm");
         // Create a new relationship between project group, project and product if needed
         $projectToProductId = Doctrine_Core::getTable("ProjectToProduct")->getProjectToProductId($projectGroupId, $projectId, $productId);
         if ($projectToProductId == null) {
             $projectToProduct = new ProjectToProduct();
             $projectToProduct->setProjectGroupId($projectGroupId);
             $projectToProduct->setProjectId($projectId);
             $projectToProduct->setProductId($productId);
             $projectToProduct->save($conn);
             $projectToProductId = $projectToProduct->getId();
         }
         // Create a new environment if needed
         $environment = Doctrine_Core::getTable("TestEnvironment")->findByArray($environmentForm);
         if ($environment == null) {
             // Add new environment
             $environment = new TestEnvironment();
             $environment->setName($environmentForm["name"]);
             $environment->setDescription($environmentForm["description"]);
             $environment->setCpu($environmentForm["cpu"]);
             $environment->setBoard($environmentForm["board"]);
             $environment->setGpu($environmentForm["gpu"]);
             $environment->setOtherHardware($environmentForm["other_hardware"]);
             // Check if its slug does not already exist and generate a new one if needed
             $slug = MiscUtils::slugify($environmentForm["name"]);
             $size = 1;
             while (Doctrine_Core::getTable("TestEnvironment")->checkSlug($slug)) {
                 $slug = MiscUtils::slugify($environmentForm["name"]) . substr(microtime(), -$size);
                 $size++;
             }
             $environment->setNameSlug($slug);
             $environment->save($conn);
             // Convert object into associative array
             $environment = $environment->toArray();
         }
         // Create a new image if needed
         $image = Doctrine_Core::getTable("Image")->findByArray($imageForm);
         if ($image == null) {
             // Add new image
             $image = new Image();
             $image->setName($imageForm["name"]);
             $image->setDescription($imageForm["description"]);
             $image->setOs($imageForm["os"]);
             $image->setDistribution($imageForm["distribution"]);
             $image->setVersion($imageForm["version"]);
             $image->setKernel($imageForm["kernel"]);
             $image->setArchitecture($imageForm["architecture"]);
             $image->setOtherFw($imageForm["other_fw"]);
             $image->setBinaryLink($imageForm["binary_link"]);
             $image->setSourceLink($imageForm["source_link"]);
             // Check if its slug does not already exist and generate a new one if needed
             $slug = MiscUtils::slugify($imageForm["name"]);
             $size = 1;
             while (Doctrine_Core::getTable("Image")->checkSlug($slug)) {
                 $slug = MiscUtils::slugify($imageForm["name"]) . substr(microtime(), -$size);
                 $size++;
             }
             $image->setNameSlug(MiscUtils::slugify($slug));
             $image->save($conn);
             // Convert object into associative array
             $image = $image->toArray();
         }
         // Create a new configuration relationship if needed
         $configurationId = Doctrine_Core::getTable("Configuration")->getConfigurationId($projectToProductId, $environment["id"], $image["id"]);
         if ($configurationId == null) {
             $configuration = new Configuration();
             $configuration->setProjectToProductId($projectToProductId);
             $configuration->setTestEnvironmentId($environment["id"]);
             $configuration->setImageId($image["id"]);
             $configuration->save($conn);
             $configurationId = $configuration->getId();
         }
         // Edit the session into DB
         $testSession = Doctrine_Core::getTable("TestSession")->find($values["id"]);
         $testSession->setId($values["id"]);
         $testSession->setBuildId($values["build_id"]);
         $testSession->setTestset($values["testset"]);
         $testSession->setName($values["name"]);
         $testSession->setTestObjective($values["test_objective"]);
         $testSession->setQaSummary($values["qa_summary"]);
         $testSession->setUserId($values["user_id"]);
//.........这里部分代码省略.........
开发者ID:alex1818,项目名称:TestReportCenter,代码行数:101,代码来源:actions.class.php

示例11: getEncryptionKey

 /**
  * Retrieves the encryption key from cache, or generations a new one in the instance one does not exists
  * @return string
  */
 public static function getEncryptionKey()
 {
     $key = self::getConfig('encryptionKey', NULL, 'settings_', true);
     if ($key == NULL || $key == "") {
         try {
             $key = Crypto::CreateNewRandomKey();
         } catch (CryptoTestFailedException $ex) {
             throw new CException('Encryption key generation failed');
         } catch (CannotPerformOperationException $ex) {
             throw new CException('Encryption key generation failed');
         }
         $config = new Configuration();
         $config->attributes = array('key' => 'encryptionkey', 'value' => bin2hex($key));
         if (!$config->save()) {
             throw new CException('Encryption key generation failed');
         }
     }
     return hex2bin(self::getConfig('encryptionKey', NULL, 'settings_', true));
 }
开发者ID:charlesportwoodii,项目名称:cii,代码行数:23,代码来源:Cii.php

示例12: actionAddCard

 /**
  * This is a temporary way to add and install new cards via Github.
  *
  * Once CiiMS.org is setup, this functionality will be deprecated in favor of a download from CiiMS.org
  * @return boolean   If the download, extraction, and install was successful
  */
 public function actionAddCard()
 {
     // Only proceed on POST
     if (Cii::get($_POST, 'Card') !== NULL) {
         $repository = Cii::get($_POST['Card'], 'new');
         if ($repository == NULL) {
             return false;
         }
         $repoInfo = explode('/', $repository);
         // Download the Card information from Github via cURL
         $curl = curl_init();
         curl_setopt_array($curl, array(CURLOPT_RETURNTRANSFER => 1, CURLOPT_URL => 'https://raw.github.com/' . $repository . '/master/card.json'));
         $json = CJSON::decode(curl_exec($curl));
         // If we have an invalid repo - abort
         if ($json == NULL) {
             throw new CHttpException(400, Yii::t('Dashboard.main', 'Unable to find valid card at that location.'));
         }
         $config = new Configuration();
         $uuid = $config->generateUniqueId();
         $config->key = 'dashboard_card_' . $uuid;
         $config->value = CJSON::encode(array('name' => Cii::get(Cii::get($json, 'name'), 'displayName'), 'class' => Cii::get(Cii::get($json, 'name'), 'name'), 'path' => 'application.runtime.cards.' . $uuid . '.' . $repoInfo[1] . '-master', 'folderName' => $uuid));
         // Determine the runtime directory
         $runtimeDirectory = Yii::getPathOfAlias('application.runtime');
         $downloadPath = $runtimeDirectory . DIRECTORY_SEPARATOR . 'cards' . DIRECTORY_SEPARATOR . $uuid . '.zip';
         if (!is_writable($runtimeDirectory)) {
             throw new CHttpException(500, Yii::t('Dashboard.main', 'Runtime directory is not writable'));
         }
         $targetFile = fopen($downloadPath, 'w');
         // Initiate the CURL request
         $ch = curl_init('https://github.com/' . $repository . '/archive/master.zip');
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
         curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
         curl_setopt($ch, CURLOPT_FILE, $targetFile);
         curl_exec($ch);
         // Extract the file
         $zip = new ZipArchive();
         $res = $zip->open($downloadPath);
         // If we can open the file
         if ($res === true) {
             // Extract it to the appropriate location
             $extraction = $zip->extractTo(str_replace('.zip', '', $downloadPath));
             // If we can extract it
             if ($extraction) {
                 // Save the config in the database
                 $config->save();
                 // Delete the zip file
                 unlink($downloadPath);
                 // Flush the cache
                 Yii::app()->cache->delete('dashboard_cards_available');
                 Yii::app()->cache->delete('cards_in_category');
                 header('Content-Type: application/json');
                 // Output the json so we can display pretty stuff in the main view
                 echo $config->value;
                 // And return true
                 return true;
             }
         }
     }
     return false;
 }
开发者ID:fandikurnia,项目名称:CiiMS,代码行数:66,代码来源:SettingsController.php

示例13: _xls_insert_conf

function _xls_insert_conf($key, $title, $value, $helperText, $configType, $options, $sortOrder = NULL, $templateSpecific = 0)
{
    $conf = Configuration::LoadByKey($key);
    if (!$conf) {
        $conf = new Configuration();
    }
    $conf->key_name = $key;
    $conf->title = $title;
    $conf->key_value = $value;
    $conf->helper_text = $helperText;
    $conf->configuration_type_id = $configType;
    $conf->options = $options;
    $query = <<<EOS
\t\tSELECT IFNULL(MAX(sortOrder),0)+1
\t\tFROM xlsws_configuration
\t\tWHERE configuration_type_id = '{$configType}';
EOS;
    if (!$sortOrder) {
        $sortOrder = Configuration::model()->findBySql($query);
    }
    $conf->sort_order = $sortOrder;
    $conf->template_specific = $templateSpecific;
    $conf->created = new CDbExpression('NOW()');
    $conf->modified = new CDbExpression('NOW()');
    if (!$conf->save()) {
        print_r($conf->getErrors());
    }
}
开发者ID:uiDeveloper116,项目名称:webstore,代码行数:28,代码来源:helpers.php


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