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


PHP Section::create方法代码示例

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


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

示例1: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $input = Input::all();
     $validation = Validator::make($input, Section::$rules);
     if ($validation->passes()) {
         $this->section->create($input);
         return Redirect::route('sections.index');
     }
     return Redirect::route('sections.create')->withInput()->withErrors($validation)->with('message', 'There were validation errors.');
 }
开发者ID:bailey9005,项目名称:Laravel-For-Landing-Pages,代码行数:15,代码来源:SectionsController.php

示例2: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Section::create(['title' => 'all', 'data' => '', 'markdown' => '']);
     $statement = "UPDATE  `sections` SET  `id` =  '0' WHERE  `sections`.`id` =1;";
     DB::unprepared($statement);
     Section::create(['title' => 'news', 'data' => '', 'markdown' => '']);
     Section::create(['title' => 'science', 'data' => '', 'markdown' => '']);
     Section::create(['title' => 'tech', 'data' => '', 'markdown' => '']);
     Section::create(['title' => 'politics', 'data' => '', 'markdown' => '']);
     Section::create(['title' => 'frogs', 'data' => '', 'markdown' => '']);
     Section::create(['title' => 'econ', 'data' => '', 'markdown' => '']);
     Section::create(['title' => 'math', 'data' => '', 'markdown' => '']);
     Section::create(['title' => 'prog', 'data' => '', 'markdown' => '']);
     Section::create(['title' => 'worms', 'data' => '', 'markdown' => '']);
     Section::create(['title' => 'worms2', 'data' => '', 'markdown' => '']);
     Section::create(['title' => 'worms2', 'data' => '', 'markdown' => '']);
     Section::create(['title' => 'worms2', 'data' => '', 'markdown' => '']);
     Section::create(['title' => 'worms2', 'data' => '', 'markdown' => '']);
     Section::create(['title' => 'worms2', 'data' => '', 'markdown' => '']);
     Section::create(['title' => 'worms2', 'data' => '', 'markdown' => '']);
     Section::create(['title' => 'worms2', 'data' => '', 'markdown' => '']);
     Section::create(['title' => 'worms2', 'data' => '', 'markdown' => '']);
     Section::create(['title' => 'worms2', 'data' => '', 'markdown' => '']);
     Section::create(['title' => 'worms2', 'data' => '', 'markdown' => '']);
     Section::create(['title' => 'worms2', 'data' => '', 'markdown' => '']);
     Section::create(['title' => 'worms2', 'data' => '', 'markdown' => '']);
 }
开发者ID:hrenos,项目名称:spreadit,代码行数:32,代码来源:SectionTableSeeder.php

示例3: store

 /**
  * Store a newly created resource in storage.
  * POST /sections
  *
  * @return Response
  */
 public function store()
 {
     $section = Section::create(Input::all());
     if ($section) {
         return ['status' => true, 'data' => $section];
     } else {
         return ['status' => false];
     }
 }
开发者ID:sahilkathpal,项目名称:hackcoin,代码行数:15,代码来源:SectionsController.php

示例4: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $data = Input::all();
     $validator = Validator::make($data, $this->rules);
     if ($validator->passes()) {
         $section = Section::create($data);
         return Redirect::to('admin/sections/' . $section->id);
     } else {
         return Redirect::back()->withInput()->withErrors($validator->messages());
     }
 }
开发者ID:mathiasd88,项目名称:cms,代码行数:16,代码来源:AdminSectionsController.php

示例5: foreach

        foreach ($sectionObj->getData() as $field => $fieldValue) {
            if ($field != 'IdLanguage') {
                $translationSectionObj->setProperty($field, $fieldValue, false);
            }
        }
        $f_section_name = Input::Get('f_section_name', 'string', $sectionObj->getName());
        $f_section_urlname = Input::Get('f_section_urlname', 'string', $sectionObj->getUrlName());
        if ($f_section_urlname == "") {
            camp_html_add_msg(getGS('You must fill in the $1 field.', '"' . getGS('New section URL name') . '"'));
            camp_html_goto_page($backLink);
        }
        if (!camp_is_valid_url_name($f_section_urlname)) {
            camp_html_add_msg(getGS('The $1 field may only contain letters, digits and underscore (_) character.', '"' . getGS('New section URL name') . '"'));
            camp_html_goto_page($backLink);
        }
        $translationSectionObj->create($f_section_name, $f_section_urlname);
        if (!$translationSectionObj->exists()) {
            camp_html_add_msg(getGS('Unable to create the section for translation $1.', $translationLanguageObj->getName()));
            camp_html_goto_page($backLink);
        }
    } else {
        $f_section_name = Input::Get('f_section_name', 'string', $sectionObj->getName());
        $f_section_urlname = Input::Get('f_section_urlname', 'string', $sectionObj->getUrlName());
        $translationSectionObj->update(array('Name' => $f_section_name, 'ShortName' => $f_section_urlname));
    }
}
if ($articleObj->translationTitleExists($f_translation_title, $f_translation_language)) {
    camp_html_add_msg(getGS("There already is an article with the same name. Please change the name and try again."), "ok");
    camp_html_goto_page($backLink);
    exit;
}
开发者ID:nidzix,项目名称:Newscoop,代码行数:31,代码来源:do_translate.php

示例6: ComparisonOperation

	$correct = false;
	$errors[] = getGS('The $1 field may only contain letters, digits and underscore (_) character.', '"' . getGS('URL Name') . '"');
}
$sectionsConstraints = array(new ComparisonOperation('idpublication', new Operator('is'), $f_publication_id),
new ComparisonOperation('nrissue', new Operator('is'), $f_issue_number),
new ComparisonOperation('number', new Operator('is'), $f_number));
$sections = Section::GetList($sectionsConstraints, null, 0, 0, $sectionsCount, true);
if ($sectionsCount > 0) {
    $correct = false;
    $errors[] = getGS('The section number $1 was already in use.', $f_number);
}
if ($correct) {
    $newSection = new Section($f_publication_id, $f_issue_number, $f_language_id, $f_number);
    $columns = array();
    $columns['Description'] = $f_description;
    $created = $newSection->create($f_name, $f_url_name, $columns);
    if ($created) {
	    if ($f_add_subscriptions) {
	        $numSubscriptionsAdded = Subscription::AddSectionToAllSubscriptions($f_publication_id, $f_number);
			if ($numSubscriptionsAdded == -1) {
	            $errors[] = getGS('Error updating subscriptions.');
			}
	    }
	    camp_html_goto_page("/$ADMIN/sections/edit.php?Pub=$f_publication_id&Issue=$f_issue_number&Language=$f_language_id&Section=".$newSection->getSectionNumber());
    }
}

$tmpArray = array('Pub' => $publicationObj, 'Issue' => $issueObj);
camp_html_content_top(getGS('Adding new section'), $tmpArray);
?>
开发者ID:nistormihai,项目名称:Newscoop,代码行数:30,代码来源:do_add.php

示例7: Section

 if (!Section::section_exists($_POST['name'], $batch->id)) {
     $object = new Section();
     $object->name = $_POST['name'];
     $object->comments = $_POST['comments'];
     $object->fbcomments = $_POST['fbcomments'];
     $object->about = $_POST['about'];
     $object->advisermessage = $_POST['advisermessage'];
     $object->schoolid = $school->id;
     $object->batchid = $batch->id;
     $object->pending = 0;
     $object->enabled = 1;
     $file = new File($_FILES['cover']);
     if ($file->valid) {
         $object->picture = $file->data;
     }
     $object->create();
     $sectionuser = new SectionUser();
     $sectionuser->userid = $session->user_id;
     $sectionuser->schoolid = $school->id;
     $sectionuser->batchid = $batch->id;
     $sectionuser->sectionid = $object->id;
     $sectionuser->level = 1;
     $sectionuser->role = "admin";
     $sectionuser->enabled = 1;
     $sectionuser->pending = 0;
     $sectionuser->create();
     $log = new Log($session->user_id, $clientip, "WEB", "CREATED SECTION: " . $object->id);
     $log->create();
     $message = "success";
 } else {
     $message = "School: " . $_POST['schoolname'] . " doesn't exist anymore. Please refresh the page.";
开发者ID:NemOry,项目名称:Skoolyf,代码行数:31,代码来源:create.php

示例8: copy

	/**
	 * Copy the section to the given issue.  The issue can be the same as
	 * the current issue.  All articles will be copied to the new section.
	 *
	 * @param int $p_destPublicationId
	 *     The destination publication ID.
	 * @param int $p_destIssueNumber
	 *     The destination issue ID.
	 * @param int $p_destIssueLanguageId
	 *     (optional) The destination issue language ID.  If not given,
	 *     it will use the language ID of this section.
	 * @param int $p_destSectionNumber
	 *     (optional) The destination section ID.  If not given, a new
	 *     section will be created.
	 * @param boolean $p_copyArticles
	 *     (optional) If set to true, all articles will be copied to the
	 *     destination section.
	 * @return Section
	 *     The new Section object.
	 */
	public function copy($p_destPublicationId, $p_destIssueNumber,
				         $p_destIssueLanguageId = null,$p_destSectionNumber = null,
				         $p_copyArticles = true)
	{
		if (is_null($p_destIssueLanguageId)) {
			$p_destIssueLanguageId = $this->m_data['IdLanguage'];
		}
		if (is_null($p_destSectionNumber)) {
			$p_destSectionNumber = $this->m_data['Number'];
		}
		$dstSectionObj = new Section($p_destPublicationId,
					$p_destIssueNumber,
					$p_destIssueLanguageId,
					$p_destSectionNumber);
		// If source issue and destination issue are the same
		if ( ($this->m_data['IdPublication'] == $p_destPublicationId)
			&& ($this->m_data['NrIssue'] == $p_destIssueNumber)
			&& ($this->m_data['IdLanguage'] == $p_destIssueLanguageId) ) {
			$shortName = $p_destSectionNumber;
			$sectionName = $this->getName() . " (duplicate)";
		} else {
			$shortName = $this->getUrlName();
			$sectionName = $this->getName();
		}
		$dstSectionCols = array();
		$dstSectionCols['SectionTplId'] = $this->m_data['SectionTplId'];
		$dstSectionCols['ArticleTplId'] = $this->m_data['ArticleTplId'];

		// Create the section if it doesnt exist yet.
		if (!$dstSectionObj->exists()) {
			$dstSectionObj->create($sectionName, $shortName, $dstSectionCols);
		}

		// Copy all the articles.
		if ($p_copyArticles) {
			$srcSectionArticles = Article::GetArticles($this->m_data['IdPublication'],
							$this->m_data['NrIssue'],
							$this->m_data['Number']);
			$copiedArticles = array();
			foreach ($srcSectionArticles as $articleObj) {
				if (!in_array($articleObj->getArticleNumber(), $copiedArticles)) {
					$tmpCopiedArticles = $articleObj->copy($p_destPublicationId,
					$p_destIssueNumber, $p_destSectionNumber, null, true);
					$copiedArticles[] = $articleObj->getArticleNumber();
				}
			}
		}

		return $dstSectionObj;
	} // fn copy
开发者ID:nistormihai,项目名称:Newscoop,代码行数:70,代码来源:Section.php

示例9: Section

require_once "../../includes/initialize.php";
global $session;
if (!$session->is_logged_in()) {
    redirect_to("../../index.php");
}
if ($_POST['oper'] == 'add') {
    $section = new Section();
    $section->name = $_POST['name'];
    $section->comments = $_POST['comments'];
    $section->about = $_POST['about'];
    $section->pending = $_POST['pending'];
    $section->enabled = $_POST['enabled'];
    $section->sectionname = $_POST['sectionname'];
    $section->schoolid = $_POST['schoolid'];
    $section->batchid = $_POST['batchid'];
    $section->create();
    $sectionuser = new SectionUser();
    $sectionuser->pending = 0;
    $sectionuser->enabled = 1;
    $sectionuser->schoolid = $section->schoolid;
    $sectionuser->sectionid = $section->id;
    $sectionuser->userid = $session->user_id;
    $sectionuser->level = 1;
    $sectionuser->create();
    $log = new Log($session->user_id, $clientip, "WEB", "CREATED SECTION: " . $_POST['id']);
    $log->create();
} else {
    if ($_POST['oper'] == 'edit') {
        $section = Section::get_by_id($_POST['id']);
        $section->name = $_POST['name'];
        $section->comments = $_POST['comments'];
开发者ID:NemOry,项目名称:Skoolyf,代码行数:31,代码来源:sections_manipulate.php

示例10: Translation

}

#footer {
\tclear: both;
\tmargin: 4mm 0mm 4mm;
\tpadding: 2mm 0mm 0mm;
\ttext-align: center;
\tborder-top: 1px solid black;
}

table.listtab {
\tborder-collapse: collapse;
}
STYLE;
            $style->save();
            $section = Section::create("home");
            $section->title["en"] = new Translation("Home", "");
            if ($lang != "en") {
                $section->title[$lang] = new Translation("Home", "");
            }
            $section->template = "standard.html";
            $section->add_style($style);
            $section->save();
            $ratatoeskr_settings["default_section"] = $section->get_id();
            $ratatoeskr_settings->save();
            $admingrp = Group::create("admins");
            $admin = user::create($_POST["admin_username"], PasswordHash::create($_POST["admin_init_password"]));
            $admin->save();
            $admingrp->include_user($admin);
            $article = Article::create("congratulations");
            $article->title["en"] = new Translation("Congratulations! You have just installed Ratatöskr!", "");
开发者ID:ratatoeskr-cms,项目名称:ratatoeskr-cms,代码行数:31,代码来源:setup.php

示例11: build_backend_subactions


//.........这里部分代码省略.........
            if ($properties[1]) {
                $ste->vars["textprocessors"][] = $txtproc;
            }
        }
        $ste->vars["sections"] = array();
        foreach (Section::all() as $section) {
            $ste->vars["sections"][] = $section->name;
        }
        $ste->vars["article_section"] = $default_section->name;
        /* Check Form */
        $fail_reasons = array();
        if (isset($_POST["save_article"])) {
            if (!Article::test_urlname($_POST["urlname"])) {
                $fail_reasons[] = $translation["invalid_urlname"];
            } else {
                $inputs["urlname"] = $_POST["urlname"];
            }
            if (!Article::test_status(@$_POST["article_status"])) {
                $fail_reasons[] = $translation["invalid_article_status"];
            } else {
                $inputs["article_status"] = (int) $_POST["article_status"];
            }
            if (!isset($textprocessors[@$_POST["content_txtproc"]])) {
                $fail_reasons[] = $translation["unknown_txtproc"];
            } else {
                $inputs["content_txtproc"] = $_POST["content_txtproc"];
            }
            if (!isset($textprocessors[@$_POST["excerpt_txtproc"]])) {
                $fail_reasons[] = $translation["unknown_txtproc"];
            } else {
                $inputs["excerpt_txtproc"] = $_POST["excerpt_txtproc"];
            }
            if (!empty($_POST["date"])) {
                if (($time_tmp = @DateTime::createFromFormat("Y-m-d H:i:s", @$_POST["date"])) === False) {
                    $fail_reasons[] = $translation["invalid_date"];
                } else {
                    $inputs["date"] = @$time_tmp->getTimestamp();
                }
            } else {
                $inputs["date"] = time();
            }
            $inputs["allow_comments"] = !(empty($_POST["allow_comments"]) or $_POST["allow_comments"] != "yes");
            try {
                $inputs["article_section"] = Section::by_name($_POST["section"]);
            } catch (DoesNotExistError $e) {
                $fail_reasons[] = $translation["unknown_section"];
            }
            $inputs["title"] = $_POST["title"];
            $inputs["content"] = $_POST["content"];
            $inputs["excerpt"] = $_POST["excerpt"];
            $inputs["tags"] = array_filter(array_map("trim", explode(",", $_POST["tags"])), function ($t) {
                return !empty($t);
            });
            if (isset($_POST["saveaslang"])) {
                $editlang = $_POST["saveaslang"];
            }
        } else {
            /* Call articleeditor plugins */
            $article = empty($article) ? NULL : Article::by_urlname($article);
            foreach ($articleeditor_plugins as $plugin) {
                call_user_func($plugin["fx"], $article, False);
            }
        }
        function fill_article(&$article, $inputs, $editlang)
        {
            $article->urlname = $inputs["urlname"];
开发者ID:ratatoeskr-cms,项目名称:ratatoeskr-cms,代码行数:67,代码来源:backend.php

示例12: Create

 public static function Create($section)
 {
     Section::create(array('section_name' => $section->section_name));
 }
开发者ID:krasaler,项目名称:FamilyStore,代码行数:4,代码来源:SectionService.php

示例13: canCreateFromDefinitionWithObjects

 /**
  * @test
  */
 public function canCreateFromDefinitionWithObjects()
 {
     $definition = array('name' => 'test', 'label' => 'Test section', 'objects' => array('object1' => array('label' => 'Test object', 'fields' => array('foo' => array('type' => 'Input', 'label' => 'Foo input')))));
     $section = Section::create($definition);
     $this->assertInstanceOf('FluidTYPO3\\Flux\\Form\\Container\\Section', $section);
 }
开发者ID:chrmue01,项目名称:typo3-starter-kit,代码行数:9,代码来源:SectionTest.php


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