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


PHP Setting::setValue方法代码示例

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


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

示例1: setValue

 /**
  * Sets value for given key name
  *
  * @param string $name
  * @param mixed $value
  * 
  */
 public static function setValue($name, $value)
 {
     $c = new Criteria();
     $c->add(SettingPeer::NAME, $name);
     if (!($setting = SettingPeer::doSelectOne($c))) {
         $setting = new Setting();
         $setting->setName($name);
     }
     $setting->setValue($value);
     $setting->save();
 }
开发者ID:royalterra,项目名称:pdns-gui,代码行数:18,代码来源:SettingPeer.php

示例2: setByKey

 public static function setByKey($key, $value, PropelPDO $con = null)
 {
     $c = new Criteria();
     $c->add(SettingPeer::KEY, $key);
     $s = SettingPeer::doSelectOne($c, $con);
     if (!$s) {
         $s = new Setting();
         $setting->setKey($key);
     }
     $s->setValue($value);
     return $s->save();
 }
开发者ID:WIZARDISHUNGRY,项目名称:sflimetracker,代码行数:12,代码来源:SettingPeer.php

示例3: apply

 /**
  * Display the specified theme.
  *
  * @param  int  $id
  * @return Response
  */
 public function apply($id)
 {
     $theme = Theme::findOrFail($id);
     \Setting::setValue("{$theme->target}_theme", $theme->id);
     return Redirect::to('backend/theme-manager')->with('success_message', 'The theme was successfully applied');
 }
开发者ID:Kr3m,项目名称:Doptor,代码行数:12,代码来源:ThemeManagerController.php

示例4: convertSurveySettings

                     $user->setLanguages($this->suid, $m, $survey->getAllowedLanguages($m));
                 }
                 $user->saveChanges();
             }
         }
     }
 }
 function convertSurveySettings($row)
 {
     $query = "replace into " . Config::dbSurvey() . "_surveys (suid, name, description) values (";
     $query .= prepareDatabaseString($this->suid) . ",";
     $query .= "'" . prepareDatabaseString($row["header"]) . "',";
     $query .= "'')";
     $this->db->executeQuery($query);
     $query = "replace into " . Config::dbSurvey() . "_versions (suid, vnid, name, description) values (";
     $query .= prepareDatabaseString($this->suid) . ",";
     $query .= prepareDatabaseString(1) . ",";
     $query .= "'Current',";
     $query .= "'Current version')";
     $this->db->executeQuery($query);
     /* add default survey */
     $setting = new Setting();
     $setting->setSuid($this->suid);
     $setting->setObject(USCIC_SURVEY);
     $setting->setObjectType(OBJECT_SURVEY);
     $setting->setName(SETTING_DEFAULT_SURVEY);
     $setting->setValue($this->suid);
     $setting->setMode(MODE_CASI);
     // dummy
     $setting->setLanguage(1);
     // dummy
     $setting->save();
     /* add default mode */
     $setting = new Setting();
     $setting->setSuid($this->suid);
     $setting->setObject(USCIC_SURVEY);
     $setting->setObjectType(OBJECT_SURVEY);
     $setting->setName(SETTING_DEFAULT_MODE);
     $setting->setMode(MODE_CASI);
     $setting->setLanguage(1);
     // dummy
     $setting->setValue(MODE_CASI);
     $setting->save();
     /* add default language */
     $setting = new Setting();
     $setting->setSuid($this->suid);
     $setting->setObject(USCIC_SURVEY);
     $setting->setObjectType(OBJECT_SURVEY);
     $setting->setName(SETTING_DEFAULT_LANGUAGE);
开发者ID:nubissurveying,项目名称:nubis,代码行数:49,代码来源:importer.php

示例5: import

 public static function import($strXml, $blnOverwrite = false, $blnKeepSettings = false)
 {
     global $objLiveAdmin, $intDefaultLanguage, $_CONF;
     $objReturn = NULL;
     $objSettings = NULL;
     $blnZip = false;
     //*** Init DOM object.
     $objDoc = new DOMDocument("1.0", "UTF-8");
     $objDoc->formatOutput = false;
     $objDoc->preserveWhiteSpace = true;
     if (is_file($strXml)) {
         $objZip = new dUnzip2($strXml);
         if (is_object($objZip)) {
             //*** Zip file.
             $strXml = $objZip->unzip('data.xml');
             if ($strXml !== false) {
                 //*** Fix a unicode bug. Replace forbidden characters (The first 8).
                 for ($intCount = 1; $intCount < 9; $intCount++) {
                     $strHex = str_pad(dechex($intCount), 4, "0", STR_PAD_LEFT);
                     $strXml = preg_replace('/\\x{' . $strHex . '}/u', "", $strXml);
                 }
                 $strXml = preg_replace('/\\x{001f}/u', "", $strXml);
                 $objDoc->loadXML($strXml);
                 $blnZip = true;
             }
         } else {
             //*** XML file.
             $objDoc->load($strXml);
         }
     } else {
         $objDoc->loadXML($strXml);
     }
     //*** Build data structure.
     foreach ($objDoc->childNodes as $rootNode) {
         if ($rootNode->nodeName == "Punch") {
             //*** Valid Punch XML.
             foreach ($rootNode->childNodes as $accountNode) {
                 if ($accountNode->nodeName == "account") {
                     //*** Account node.
                     if ($blnOverwrite) {
                         $objAccount = Account::getByPunchId($accountNode->getAttribute("punchId"));
                         if (is_object($objAccount) && $blnKeepSettings) {
                             //*** Save settings.
                             $objSettings = Settings::getByAccount($objAccount->getId());
                         }
                         //*** Remove account.
                         if (is_object($objAccount)) {
                             $objAccount->delete();
                         }
                     }
                     //*** Create account.
                     $objAccount = new Account();
                     $objAccount->setPunchId($accountNode->getAttribute("punchId"));
                     $objAccount->setName($accountNode->getAttribute("name"));
                     $objAccount->setUri($accountNode->getAttribute("uri"));
                     $objAccount->setTimeZoneId(42);
                     $objAccount->save();
                     //*** Create temporary account object.
                     $_CONF['app']['account'] = $objAccount;
                     foreach ($accountNode->childNodes as $childNode) {
                         $arrUserIds = array();
                         $arrGroupIds = array();
                         switch ($childNode->nodeName) {
                             case "acl":
                                 self::importAcl($childNode, $objAccount->getId(), $arrUserIds, $arrGroupIds);
                                 break;
                             case "products":
                                 //*** Add products to the account.
                                 foreach ($childNode->childNodes as $productNode) {
                                     switch ($productNode->nodeName) {
                                         case "pcms":
                                             //*** Add PunchCMS product to the account.
                                             $objAccountProduct = new AccountProduct();
                                             $objAccountProduct->setAccountId($objAccount->getId());
                                             $objAccountProduct->setProductId(PRODUCT_PCMS);
                                             $objAccountProduct->setExpires($productNode->getAttribute("expires"));
                                             $objAccountProduct->save();
                                             $arrStorageIds[0] = 0;
                                             $arrFeedIds[0] = 0;
                                             //*** Add PunchCMS data to the account.
                                             foreach ($productNode->childNodes as $pcmsNode) {
                                                 switch ($pcmsNode->nodeName) {
                                                     case "settings":
                                                         //*** Add settings to the account.
                                                         if ($blnKeepSettings && is_object($objSettings)) {
                                                             foreach ($objSettings as $objSetting) {
                                                                 $objSetting->setId(0);
                                                                 $objSetting->setAccountId($objAccount->getId());
                                                                 $objSetting->save();
                                                             }
                                                         } else {
                                                             foreach ($pcmsNode->childNodes as $settingNode) {
                                                                 $objSettingTemplate = SettingTemplate::selectByName($settingNode->getAttribute("name"));
                                                                 if (is_object($objSettingTemplate)) {
                                                                     $objSetting = new Setting();
                                                                     $objSetting->setAccountId($objAccount->getId());
                                                                     $objSetting->setSettingId($objSettingTemplate->getId());
                                                                     $objSetting->setValue($settingNode->getAttribute("value"));
                                                                     $objSetting->save();
                                                                 }
//.........这里部分代码省略.........
开发者ID:laiello,项目名称:punchcms,代码行数:101,代码来源:class.impex.php

示例6: setSettingDirectly

 function setSettingDirectly($object, $objecttype, $name, $value, $mode = "", $language = "")
 {
     $setting = new Setting();
     $setting->setSuid($this->getSuid());
     $setting->setLanguage($language);
     $setting->setMode($mode);
     $setting->setName($name);
     $setting->setObject($object);
     $setting->setObjectType($objecttype);
     $setting->setValue($value);
     $setting->save();
 }
开发者ID:nubissurveying,项目名称:nubis,代码行数:12,代码来源:survey.php

示例7: catch

    } else {
        $setting->setOwnerId(0);
    }
    if (fRequest::isPost()) {
        try {
            $setting->populate();
            fRequest::validateCSRFToken(fRequest::get('token'));
            $setting->store();
            $setting_url = Setting::makeUrl('list', $setting_type);
            fMessaging::create('affected', fURL::get());
            fMessaging::create('success', fURL::get(), 'The setting ' . $setting->getFriendlyName() . ' was successfully created');
            fURL::redirect($setting_url);
        } catch (fExpectedException $e) {
            fMessaging::create('error', fURL::get(), $e->getMessage());
        }
    } else {
        $setting->setValue($list_plugin_settings[$setting_name]['default']);
    }
    include VIEW_PATH . '/add_edit_setting.php';
} else {
    if ('user' == $setting_type) {
        $current_plugin_user_settings = Setting::findAll(array('type=' => 'user', 'owner_id=' => $owner_id));
        foreach ($current_plugin_user_settings as $user_setting) {
            $plugin_user_settings[$user_setting->getName()]['value'] = $user_setting->getValue();
        }
        $list_plugin_settings = $plugin_user_settings;
    } else {
        $list_plugin_settings = $plugin_settings;
    }
    include VIEW_PATH . '/list_settings.php';
}
开发者ID:nagyist,项目名称:Tattle,代码行数:31,代码来源:setting.php

示例8: parseSetting

function parseSetting($intElmntId, $strCommand)
{
    global $_PATHS, $objLang, $_CLEAN_POST, $_CONF, $objLiveUser;
    $objTpl = new HTML_Template_IT($_PATHS['templates']);
    $objTpl->loadTemplatefile("setting.tpl.htm");
    //*** Post the profile form if submitted.
    if (count($_CLEAN_POST) > 0 && !empty($_CLEAN_POST['dispatch']) && $_CLEAN_POST['dispatch'] == "editSettings") {
        //*** The element form has been posted.
        $blnError = false;
        //*** Check sanitized input.
        if (is_null($_CLEAN_POST["dispatch"])) {
            $blnError = true;
        }
        if ($blnError === true) {
            //*** Display global error.
            $objTpl->setVariable("ERROR_SETTINGS_MAIN", $objLang->get("main", "formerror"));
        } else {
            //*** Remove current settings.
            Setting::clearFields();
            //*** Save the settings.
            foreach ($_REQUEST as $key => $value) {
                if ($value != "" && substr($key, 0, 4) == "sfv_") {
                    //*** Get the template Id from the request
                    $intTemplateFieldId = substr($key, 4);
                    //*** Is the Id really an Id?
                    if (is_numeric($intTemplateFieldId)) {
                        //*** Save the setting.
                        if (!empty($value)) {
                            $objField = new Setting();
                            $objField->setAccountId($_CONF['app']['account']->getId());
                            $objField->setSettingId($intTemplateFieldId);
                            $objField->setUsername($objLiveUser->getProperty('name'));
                            $objSettingTemplate = SettingTemplate::selectByPk($intTemplateFieldId);
                            switch ($objSettingTemplate->getType()) {
                                case "text":
                                case "number":
                                case "password":
                                    $objField->setValue($value);
                                    break;
                                case "checkbox":
                                    $objField->setValue(1);
                                    break;
                            }
                            $objField->save();
                        }
                    }
                }
            }
            //*** Move imported files to the remote server.
            ImpEx::moveImportedFiles($_CONF['app']['account']);
            header("Location: " . Request::getURI() . "/?cid=" . $_POST["cid"]);
            exit;
        }
    }
    $objTpl->setVariable("SETTINGS", $objLang->get("settings", "label"));
    $objSections = SettingTemplate::select("SELECT DISTINCT section FROM pcms_setting_tpl ORDER BY sort");
    foreach ($objSections as $objSection) {
        //*** Fields.
        $strSql = sprintf("SELECT * FROM pcms_setting_tpl WHERE section = '%s' ORDER BY sort", $objSection->getSection());
        $objSettings = SettingTemplate::select($strSql);
        foreach ($objSettings as $objSetting) {
            $strValue = Setting::getValueByName($objSetting->getName());
            $objTpl->setCurrentBlock("setting.{$objSetting->getType()}");
            $objTpl->setVariable("FIELD_ID", "sfv_{$objSetting->getId()}");
            $objTpl->setVariable("FIELD_LABEL", $objLang->get($objSetting->getName(), "settingsLabel"));
            switch ($objSetting->getType()) {
                case "text":
                case "password":
                    $objTpl->setVariable("FIELD_VALUE", $strValue);
                    $objTpl->setVariable("FIELD_TYPE", $objSetting->getType());
                    break;
                case "number":
                    $objTpl->setVariable("FIELD_VALUE", $strValue);
                    break;
                case "checkbox":
                    $strValue = $strValue ? "checked=\"checked\"" : "";
                    $objTpl->setVariable("FIELD_VALUE", $strValue);
                    break;
            }
            $objTpl->parseCurrentBlock();
        }
        $objTpl->setCurrentBlock("section");
        $objTpl->setVariable("SECTION", $objSetting->getSection());
        if ($objSections->key() != 0) {
            $objTpl->setVariable("CLASS", " class=\"anchor\"");
        }
        $objTpl->parseCurrentBlock();
        //*** Tabs.
        $objTpl->setCurrentBlock("section.tab");
        $objTpl->setVariable("SECTION", $objSection->getSection());
        $objTpl->setVariable("LABEL", $objLang->get("section_{$objSection->getSection()}", "settingsLabel"));
        if ($objSections->key() == 0) {
            $objTpl->setVariable("CLASS", " class=\"on\"");
        }
        $objTpl->parseCurrentBlock();
    }
    $objTpl->setVariable("LABEL_SAVE", $objLang->get("save", "button"));
    $objTpl->setVariable("CID", NAV_PCMS_SETTINGS);
    $objTpl->setVariable("CMD", $strCommand);
    $objTpl->setVariable("EID", $intElmntId);
//.........这里部分代码省略.........
开发者ID:laiello,项目名称:punchcms,代码行数:101,代码来源:inc.tplparse_setting.php

示例9: getSettingValue

     }
     return "";
 }
 function getSettingValue($name, $default = true)
 {
     return $this->getSetting($name, $default)->getValue();
 }
 function setSettingValue($name, $value)
 {
     /* determine index */
     $index = strtoupper($name . getSurveyMode() . getSurveyLanguage() . $this->getObjectType());
     /* don't store if follow generic/follow type (these are implicitly derived, 
      * so no need to store them explicitly). Also don't store if empty (if something should be empty
      * like a text, then enter &nbsp; for example as value).
      * If we had a value stored before, then we remove it now.
      */
     if (inArray($value, array("", SETTING_FOLLOW_GENERIC, SETTING_FOLLOW_TYPE))) {
         if (isset($this->settings[$index])) {
             $s = $this->settings[$index];
             if ($s != null) {
                 $s->remove();
             }
             unset($this->settings[$index]);
         }
         return;
     }
     /* update */
     if (isset($this->settings[$index])) {
         $this->settings[$index]->setValue($value);
     } else {
         /* create new */
开发者ID:nubissurveying,项目名称:nubis,代码行数:31,代码来源:component.php


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