本文整理汇总了PHP中Section::setName方法的典型用法代码示例。如果您正苦于以下问题:PHP Section::setName方法的具体用法?PHP Section::setName怎么用?PHP Section::setName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Section
的用法示例。
在下文中一共展示了Section::setName方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create
/**
* @return Config
*/
public function create()
{
// Parse config
$config = new Config();
// Parse mode
switch ($this->data['config']['mode']) {
case Config::MODE_GENERATE:
$mode = Config::MODE_GENERATE;
break;
case Config::MODE_RUN:
$mode = Config::MODE_RUN;
break;
default:
$mode = Config::MODE_TEST;
}
// Set mode (run|generate|test)
$config->setMode($mode);
$config->setLogFile($this->data['config']['logFile']);
$config->setTempDir(isset($this->data['config']['tempDir']) ? $this->data['config']['tempDir'] : sys_get_temp_dir() . '/deployment');
// Set or detect colors support
if ($this->data['config']['colors'] !== NULL) {
$config->setColors((bool) $this->data['config']['colors']);
} else {
$config->setColors(PHP_SAPI === 'cli' && (function_exists('posix_isatty') && posix_isatty(STDOUT) || getenv('ConEmuANSI') === 'ON' || getenv('ANSICON') !== FALSE));
}
// Set user data
$config->setUserdata($this->data['userdata']);
// Set plugins
$config->setPlugins($this->data['plugins']);
// Parse sections
foreach ($this->data['sections'] as $name => $sdata) {
$section = new Section();
$section->setName($name);
$section->setTestMode($sdata['testMode']);
$section->setLocal($sdata['local']);
$section->setRemote($sdata['remote']);
$section->setPreprocess($sdata['preprocess']);
$section->setPreprocessMasks($sdata['preprocess'] !== FALSE ? $sdata['preprocess'] : []);
$section->setAllowDelete($sdata['allowdelete']);
$section->setIgnoreMasks($sdata['ignore']);
$section->setDeployFile($sdata['deployFile']);
$section->setAfterCallbacks($sdata['after']);
$section->setBeforeCallbacks($sdata['before']);
$section->setPassiveMode($sdata['passiveMode']);
$section->setPurges($sdata['purge']);
// Add to config
$config->addSection($section);
}
return $config;
}
示例2: while
function _saveSections()
{
require_once 'AMP/Content/Section.inc.php';
$section_count = 1;
$form =& $this->get_form();
while (isset($this->_request_vars[$this->_get_section_fieldname($section_count)]) && $this->_request_vars[$this->_get_section_fieldname($section_count)]) {
$name = $this->_request_vars[$this->_get_section_fieldname($section_count)];
$text = $this->_request_vars[$this->_get_section_fieldname($section_count, 'text')];
$section = new Section(AMP_Registry::getDbcon());
$section->setName($name);
$section->setBlurb($text);
$section->setParent();
$section->setListType();
if (!($result = $section->save())) {
++$section_count;
continue;
}
$section->publish();
$section->reorder($section_count);
$form->setValues(array($this->_get_section_fieldname($section_count) => '', $this->_get_section_fieldname($section_count, 'text') => ''));
$this->message(sprintf(AMP_TEXT_DATA_SAVE_SUCCESS, $section->getName()));
++$section_count;
}
}
示例3: underscore
if ($cName == "") {
camp_html_add_msg(getGS('You must fill in the $1 field.','"'.getGS('Name').'"'));
}
if ($cShortName == "") {
camp_html_add_msg(getGS('You must fill in the $1 field.','"'.getGS('URL Name').'"'));
}
$isValidShortName = camp_is_valid_url_name($cShortName);
if (!$isValidShortName) {
camp_html_add_msg(getGS('The $1 field may only contain letters, digits and underscore (_) character.', '"' . getGS('URL Name') . '"'));
}
$editUrl = "/$ADMIN/sections/edit.php?Pub=$Pub&Issue=$Issue&Language=$Language&Section=$Section";
if (!camp_html_has_msgs()) {
$modified = true;
$modified &= $sectionObj->setName($cName);
$modified &= $sectionObj->setDescription($cDescription);
$modified &= $sectionObj->setSectionTemplateId($cSectionTplId);
$modified &= $sectionObj->setArticleTemplateId($cArticleTplId);
if ($cSubs == "a") {
$numSubscriptionsAdded = Subscription::AddSectionToAllSubscriptions($Pub, $Section);
if ($numSubscriptionsAdded < 0) {
$errors[] = getGS('Error updating subscriptions.');
}
}
if ($cSubs == "d") {
$numSubscriptionsDeleted = Subscription::DeleteSubscriptionsInSection($Pub, $Section);
if ($numSubscriptionsDeleted < 0) {
$errors[] = getGS('Error updating subscriptions.');
}
示例4: showEditSectionRes
function showEditSectionRes()
{
$displaySysAdmin = new DisplaySysAdmin();
$survey = new Survey($_SESSION['SUID']);
$seid = getFromSessionParams('seid');
$content = "";
if ($seid != '') {
//edit
$section = $survey->getSection($seid);
$_SESSION['SEID'] = $seid;
$content = $displaySysAdmin->displaySuccess(Language::messageSectionChanged(loadvar(SETTING_NAME)));
} else {
//add section!
if (loadvar(SETTING_NAME) != "") {
$section = new Section();
$section->setSuid($_SESSION['SUID']);
$content = $displaySysAdmin->displaySuccess(Language::messageSectionAdded(loadvar(SETTING_NAME)));
}
}
$checker = new Checker($_SESSION['SUID']);
if ($seid == '') {
$checks = $checker->checkName(loadvar(SETTING_NAME));
if (sizeof($checks) > 0) {
$content = implode("<br/>", $checks);
return $this->showAddSection($content);
}
}
//ADD ALL SORTS OF CHECKS!!
if ($seid != '' || loadvar(SETTING_NAME) != "") {
$section->setName(trim(loadvar(SETTING_NAME)));
$section->setDescription(loadvar(SETTING_DESCRIPTION));
$section->setHidden(loadvar(SETTING_HIDDEN));
$section->setHeader(loadvarAllowHTML(SETTING_SECTION_HEADER));
$section->setFooter(loadvarAllowHTML(SETTING_SECTION_FOOTER));
$section->save();
$checks = $checker->checkSection($section);
if (sizeof($checks) > 0) {
$content .= $displaySysAdmin->displayError(implode("<br/>", $checks));
}
}
/* compile */
$compiler = new Compiler($_SESSION['SUID'], getSurveyVersion($survey));
$mess = $compiler->generateSections(array($section));
$mess = $compiler->generateGetFillsSections(array($section));
$mess = $compiler->generateInlineFieldsSections(array($section));
/* update last page */
$_SESSION['LASTPAGE'] = substr($_SESSION['LASTPAGE'], 0, strripos($_SESSION['LASTPAGE'], "res"));
if ($seid != '') {
return $displaySysAdmin->showEditSection($_SESSION['SEID'], $content);
} else {
return $displaySysAdmin->showSurvey($content);
}
}
示例5: getAllSection
function getAllSection()
{
$key = 'section';
$collection = CacheManager::get($key, TRUE);
if ($collection) {
return $collection;
}
$collection = new Collection();
$this->connect();
$result = $this->conn->query("CALL sp_get_all_section()");
if ($result) {
//$row = $result->fetch_assoc();
while ($obj = $result->fetch_object()) {
$section = new Section();
$section->setId($obj->Section_id);
$section->setName($obj->Section_name);
$collection->addItem($section, $obj->Section_id);
}
$result->close();
// for fetch_object()
}
//$result->free_result(); // for fetch_assoc()
$this->close();
CacheManager::set($key, $collection, TRUE);
return $collection;
}
示例6: Section
function _checkNewSection($data, $fieldname)
{
if (!(isset($data['new_section_name']) && $data['new_section_name'])) {
if (!isset($data[$fieldname])) {
return false;
}
return $data[$fieldname];
}
require_once 'AMP/Content/Section.inc.php';
$section = new Section(AMP_Registry::getDbcon());
$section->setDefaults();
$section->setName($data['new_section_name']);
$section->setParent($data['new_section_parent']);
if (!($result = $section->save())) {
return $data[$fieldname];
}
$section->publish();
$flash =& AMP_System_Flash::instance();
$flash->add_message(sprintf(AMP_TEXT_DATA_SAVE_SUCCESS, $section->getName()));
return $section->id;
}
示例7: loadEntities
protected function loadEntities($simulator, $datasources)
{
foreach ($datasources->DataSource as $datasource) {
$datasourceObj = new DataSource($this, (int) $datasource['id'], (string) $datasource['name'], (string) $datasource['type']);
$datasourceObj->setUri((string) $datasource['uri']);
$datasourceObj->setMethod((string) $datasource['method']);
$datasourceObj->setDatabase((int) $datasource['database']);
$datasourceObj->setDescription((string) $datasource->Description);
foreach ($datasource->Namespace as $namespace) {
$datasourceObj->addNamespace((string) $namespace['prefix'], (string) $namespace['uri']);
}
$this->datasources[] = $datasourceObj;
}
if ($datasources->Databases) {
foreach ($datasources->Databases->Database as $database) {
$databaseObj = new Database($this, (int) $database['id'], (string) $database['type'], (string) $database['name']);
$databaseObj->setLabel((string) $database['label']);
$databaseObj->setHost((string) $database['host']);
$databaseObj->setPort((int) $database['port']);
$databaseObj->setUser((string) $database['user']);
if ((string) $database['password'] != '') {
$databaseObj->setPassword((string) $database['password']);
} elseif ((string) $database['user'] != '') {
try {
$user = $this->controller->get('kernel')->getContainer()->getParameter('database_user');
if ((string) $database['user'] == $user) {
$databaseObj->setPassword($this->controller->get('kernel')->getContainer()->getParameter('database_password'));
}
} catch (\Exception $e) {
}
}
$this->databases[] = $databaseObj;
}
}
$this->setName((string) $simulator["name"]);
$this->setLabel((string) $simulator["label"]);
$this->setDefaultView((string) $simulator["defaultView"]);
$this->setReferer((string) $simulator["referer"]);
$this->setDynamic((string) $simulator['dynamic'] == '1');
$this->setMemo((string) $simulator['memo'] == '1');
$this->setDescription((string) $simulator->Description);
$this->setRelatedInformations($simulator->RelatedInformations);
$this->setDateFormat((string) $simulator->DataSet['dateFormat']);
$this->setDecimalPoint((string) $simulator->DataSet['decimalPoint']);
$this->setMoneySymbol((string) $simulator->DataSet['moneySymbol']);
$this->setSymbolPosition((string) $simulator->DataSet['symbolPosition']);
if ($simulator->DataSet) {
foreach ($simulator->DataSet->children() as $child) {
if ($child->getName() == "DataGroup") {
$datagroup = $child;
$dataGroupObj = new DataGroup($this, (int) $datagroup['id'], (string) $datagroup['name']);
$dataGroupObj->setLabel((string) $datagroup['label']);
$dataGroupObj->setDescription((string) $datagroup->Description);
foreach ($datagroup->Data as $data) {
$dataGroupObj->addData($this->loadData($data));
}
$this->datas[] = $dataGroupObj;
} elseif ($child->getName() == "Data") {
$this->datas[] = $this->loadData($child);
}
}
}
if ($simulator->Profiles) {
$this->profiles = new Profiles($this);
$this->profiles->setLabel((string) $simulator->Profiles['label']);
foreach ($simulator->Profiles->Profile as $profile) {
$profileObj = new Profile((int) $profile['id'], (string) $profile['name']);
$profileObj->setLabel((string) $profile['label']);
$profileObj->setDescription((string) $profile->Description);
foreach ($profile->Data as $data) {
$profileObj->addData((int) $data['id'], (string) $data['default']);
}
$this->profiles->addProfile($profileObj);
}
}
if ($simulator->Steps) {
$step0 = false;
foreach ($simulator->Steps->Step as $step) {
$stepObj = new Step($this, (int) $step['id'], (string) $step['name'], (string) $step['label'], (string) $step['template']);
if ($stepObj->getId() == 0) {
$step0 = true;
}
$stepObj->setOutput((string) $step['output']);
$stepObj->setDescription((string) $step->Description);
$stepObj->setDynamic((string) $step['dynamic'] == '1');
foreach ($step->Panels->Panel as $panel) {
$panelObj = new Panel($stepObj, (int) $panel['id']);
$panelObj->setName((string) $panel['name']);
$panelObj->setLabel((string) $panel['label']);
foreach ($panel->children() as $block) {
if ($block->getName() == "FieldSet") {
$fieldset = $block;
$fieldsetObj = new FieldSet($panelObj, (int) $fieldset['id']);
$fieldsetObj->setLegend((string) $fieldset->Legend);
if ((string) $fieldset['disposition'] != "") {
$fieldsetObj->setDisposition((string) $fieldset['disposition']);
}
if ((string) $fieldset['display'] != "") {
$fieldsetObj->setDisplay((string) $fieldset['display']);
}
//.........这里部分代码省略.........