public function testPHP構文チェック異常系() { $this->markTestIncomplete('このテストは、まだ実装されていません。'); $this->Page->create(array('Page' => array('name' => 'test', 'contents' => '<?php ??>'))); $this->assertFalse($this->Page->validates()); $this->assertArrayHasKey('contents', $this->Page->validationErrors); $this->assertEquals("PHPの構文エラーです: \nPHP Parse error: syntax error, unexpected '?' in - on line 1 \nErrors parsing -", current($this->Page->validationErrors['contents'])); }
protected function createComponentPageEditForm($name) { $form = $this->createPageFormBase($name, false); if (!$form->isSubmitted()) { $id = $this->getParam("id"); $page = Page::find($id); $values = $page->getValues(); $values["tags"] = $page->Tags->fetchColumn("id"); $form->setDefaults($values); } $presenter = $this; $form->onSubmit[] = function ($form) use($presenter) { $values = $form->values; try { $page = Page::create($values); $page->Tags = array_map(function ($id) { return Tag::create($id); }, $values["tags"]); $page->save(); $presenter->flashMessage("Page '{$page->name}' was changed!"); $presenter->redirect("default", array("id" => $page->id)); } catch (ModelException $e) { $page->addErrorsToForm($form); } }; }
/** * 默认函数 * Enter description here ... */ public function index() { $pageIndex = $this->input->get('page') ? $this->input->get('page') : 1; $xml = new XML(); $file = fopen("Area.xml", "r") or die("Unable to open file!"); //读取XML内容 $filetxt = ""; $filetxt = fread($file, filesize("../uploadfile/Area/Area.xml")); //将文件中的序列化字符串读出 $unTreeresult = $xml->xml_unserialize($filetxt); //反序成内容 fclose($file); //关闭文件 $tree = new Tree(); //新建一个树 $totalCount = count($unTreeresult["root"]["item"]); //获得数据总条目 $pageSize = 100; $first = ($pageIndex - 1) * $pageSize; //得到获得数组循环的首下表 $end = $pageIndex * $pageSize; //尾下标-1 $end <= $totalCount ? "" : ($end = $totalCount); $result = array(); //取得小树 for ($first; $first < $end; $first++) { $result[] = $unTreeresult["root"]["item"][$first]; } $page = new Page(); $str_page = $page->create($pageIndex, $pageSize, $totalCount, array(), array()); $data['page'] = $str_page; $data['result'] = $result; $this->load->view('Area/list', $data); }
public function indexAction() { $score_list = $this->sScore->getSearchList($this->getParams(), $this->_offset, $this->_pagesize); $score_count = $this->sScore->getSearchCount($this->getParams()); $data = array('params' => $this->getParams(), 'score_list' => $score_list, 'page' => Page::create($score_count, $this->_pagesize), 'score_type' => $this->sCommon->getScoretype()); $this->view("index", $data); }
public function run() { $faker = Faker::create(); foreach (range(1, 10) as $index) { Page::create([]); } }
public function run() { $faker = Faker::create(); foreach (range(1, 10) as $index) { Page::create(['title' => $faker->sentence($nbWords = 6), 'slug' => 'first-page', 'body' => $faker->sentence($nbSentences = 5), 'user_id' => 1]); } }
public function run() { DB::table('article')->delete(); for ($i = 0; $i < 10; $i++) { Page::create(['name' => 'Name ' . $i, 'user_id' => '1', 'content' => 'Body- ' . $i]); } }
public function DetailAction($push_id) { $domian_list = $this->sPushDetail->getSearchList($push_id, $this->getParams(), $this->_offset, $this->_pagesize); $domian_count = $this->sPushDetail->getSearchCount($push_id, $this->getParams()); $data = array('params' => $this->getParams(), 'domain_list' => $domian_list, 'page' => Page::create($domian_count, $this->_pagesize)); $this->view("detail", $data); }
public function indexAction() { $member_list = $this->sMembers->getSearchList($this->getParams(), $this->_offset, $this->_pagesize); $member_count = $this->sMembers->getSearchCount($this->getParams()); $data = array('params' => $this->getParams(), 'member_list' => $member_list, 'page' => Page::create($member_count, $this->_pagesize), "product_cat" => json_encode($this->sProductCat->getProductCat()), "product_cat2" => $this->sProductCat->getProductCat(2)); $this->view("index", $data); }
public function run() { DB::table('pages')->truncate(); Page::create(['title' => "Home Page", 'body' => 'This will be your home page', 'published' => 1, 'slug' => '/home', 'seo' => 'HOME PAGE SEO', 'menu_sort_order' => 0, 'menu_parent' => 0, 'menu_name' => 'top', 'redirect_url' => '']); Page::create(['title' => "About Page", 'body' => 'This will be your about page', 'published' => 1, 'slug' => '/about', 'seo' => 'ABOUT PAGE SEO', 'menu_sort_order' => 1, 'menu_parent' => 1, 'menu_name' => 'top', 'redirect_url' => '']); Page::create(['title' => "Contact Page", 'body' => 'This will be your Contact page', 'published' => 1, 'slug' => '/contact', 'menu_sort_order' => 3, 'menu_parent' => 0, 'seo' => 'CONTACT PAGE SEO', 'menu_name' => 'top', 'redirect_url' => '']); Page::create(['title' => "All Projects", 'body' => 'All Projects on the site edit Pages and Projects to add text here', 'published' => 1, 'slug' => '/all_projects', 'menu_sort_order' => 2, 'menu_parent' => 0, 'seo' => 'ALL PROJECTS SEO', 'menu_name' => 'left_side', 'redirect_url' => '']); }
public function run() { DB::table('page')->delete(); Page::create(array('title' => 'Home', 'content' => 'Home content', 'user_id' => 1, 'keywords' => 'home', 'description' => 'Home', 'type' => 1, 'start' => 1, 'active' => 1, 'path' => 'home')); Page::create(array('title' => 'Service', 'content' => '', 'user_id' => 1, 'keywords' => '', 'description' => '', 'type' => 1, 'start' => 1, 'active' => 1, 'path' => 'service')); Page::create(array('title' => 'Occasions', 'content' => 'Occasions', 'user_id' => 1, 'keywords' => '', 'description' => '', 'type' => 3, 'start' => 1, 'active' => 1, 'path' => 'occasions')); Page::create(array('title' => 'Contact', 'content' => 'Contact us with the following information:', 'user_id' => 1, 'keywords' => '', 'description' => '', 'type' => 2, 'start' => 1, 'active' => 1, 'path' => 'contact')); }
public function IndexAction() { $domain_list = array(); $domian_list = $this->sDomain->getSearchList($this->getParams(), $this->_offset, $this->_pagesize); $domian_count = $this->sDomain->getSearchCount($this->getParams()); $data = array('params' => $this->getParams(), 'domain_list' => $domian_list, "product_cat" => json_encode($this->sProductCat->getProductCat()), "product_cat2" => $this->sProductCat->getProductCat(2), 'page' => Page::create($domian_count, $this->_pagesize)); $this->view("index", $data); }
public function testNewRecordWithNewReferenced() { $page = Page::create(array("name" => "English article", "description" => "Description", "text" => "Text in english.", "allowed" => true)); $page->Tags[] = Tag::create(array("name" => "Society", "url" => "society")); $page->Tags[] = Tag::create(array("name" => "Previte", "url" => "previte")); $page->save(); $this->assertEquals(2, count(Page::findByName("English article")->Tags)); }
public function testNewRecordWithNewReferenced() { $page = Page::create(array("name" => "English article", "description" => "Description", "text" => "Text in english.", "allowed" => true)); $page->Comments[] = Comment::create(array("text" => "muj názor", "name" => "Honza", "mail" => "*****@*****.**")); $page->Comments[] = Comment::create(array("text" => "muj jiný názor", "name" => "Honza", "mail" => "*****@*****.**")); $page->save(); $this->assertEquals(2, count(Page::findByName("English article")->Comments)); }
public function IndexAction() { $article_list = $this->sArticles->getSearchList($this->getParams(), $this->_offset, $this->_pagesize); $article_count = $this->sArticles->getSearchCount($this->getParams()); $data = array('params' => $this->getParams(), 'article_list' => $article_list, 'article_type' => $this->sCommon->getArticleCats(), 'audit_list' => $this->audit_list, 'page' => Page::create($article_count, $this->_pagesize)); //print_r($data);die(); $this->view("index", $data); }
public function run() { $faker = Faker::create(); foreach (range(1, 10) as $index) { $title = $faker->sentence(); $slug = str_replace(' ', '-', $title); Page::create(['title' => $title, 'slug' => $slug, 'body' => $faker->realText(1000)]); } }
/** * Store a newly created video in storage. * * @return Response */ public function store() { $validator = Validator::make($data = Input::all(), Page::$rules); if ($validator->fails()) { return Redirect::back()->withErrors($validator)->withInput(); } $page = Page::create($data); return Redirect::to('admin/pages')->with(array('note' => 'New Page Successfully Added!', 'note_type' => 'success')); }
public function addPage($at = null, $fileKey, $oldName) { $this->_pageKeys[] = $fileKey; $page = new Page($this->_DBI); $page->setKey($fileKey); $page->set('oldFileName', $oldName); $page->set('scriptKey', $this->_script->getKey()); $page->create(); }
private function newPage() { Base::requireAdmin(); do { $page = Page::create(); $page->slug = Base::uniq(6); $page->save(); } while (!$page); Base::redirect('/page/' . $page->slug . '/edit'); }
/** * 默认函数 * Enter description here ... */ public function index() { $pageIndex=$this->input->get('page')?$this->input->get('page'):1; //$res = wddx_serialize_value($treeResult );//序列化为XML //echo ($res."</br>-----------------" ); //$file=fopen("Area.txt","w"); //fwrite($file, $res); //$filetxt=fread($file,1000); //$unres = wddx_deserialize($filetxt);//反序列化为数组 // print_r($filetxt); //fclose("uploadfile/Area/Area.txt"); $xml = new XML(); //$res=$xml->xml_serialize($treeResult,0,null); // $file = fopen("Area.xml", "w"); //fwrite($file, $res);//将序列化的字符写进文件 // print_r($res); //fclose($file); //$file = fopen("Area.txt", "r"); //$filetxt = fread($file,filesize("Area.txt"));//将文件中的序列化字符串读出 //while(!feof($file)) //{ // $filetxt=$filetxt.fgets($file); //} //echo $filetxt; $file = fopen("Area.xml","r") or die("Unable to open file!");//读取XML内容 $filetxt =""; $filetxt = fread($file,filesize("../uploadfile/Area/Area.xml"));//将文件中的序列化字符串读出 $unTreeresult =$xml->xml_unserialize($filetxt);//反序成内容 fclose($file);//关闭文件 $tree=new Tree();//新建一个树 $totalCount = count($unTreeresult["root"]["item"]);//获得数据总条目 $pageSize=100; $first =($pageIndex-1)*$pageSize; //得到获得数组循环的首下表 $end = $pageIndex*$pageSize;//尾下标-1 $end <= $totalCount?"":$end=$totalCount; $result = array();//取得小树 for ($first;$first<$end;$first++) { $result[] = $unTreeresult["root"]["item"][$first]; } $page=new Page(); $str_page=$page->create($pageIndex, $pageSize, $totalCount, array(), array()); $data['page']=$str_page; $data['result']=$result; $this->load->view('Area/list',$data); }
/** * Store a newly created page in storage. * * @return Response */ public function store() { $data = Input::all(); $data['slug'] = $this->slugify(Input::get('title')); $validator = Validator::make($data, Page::$rules); if ($validator->fails()) { return Redirect::back()->withErrors($validator)->withInput(); } $page = Page::create($data); return Redirect::route('admin.pages.index')->with("message", "Data berhasil disimpan"); }
/** * 默认函数 * Enter description here ... */ public function index() { $pageSize = 12; $pageIndex = $this->input->get('page') ? $this->input->get('page') : 1; $strWhere = ' a.pid!=0'; $orderBy = ''; $totalCount = $this->CircleModel->getCircleCountByWhere($strWhere); $circle = $this->CircleModel->getCircleByPage($pageSize, $pageIndex, $strWhere, $orderBy); $page = new Page(); $str_page = $page->create($pageIndex, $pageSize, $totalCount, array(), array()); $this->load->view('Circle/list', array('page' => $str_page, 'circle' => $circle)); }
/** * 默认函数 * Enter description here ... */ public function index() { $pageSize = 12; $pageIndex = $this->input->get('page') ? $this->input->get('page') : 1; $strWhere = 'pid=0'; $orderBy = ''; $totalCount = $this->CircleModel->getListCountByWhere($strWhere); $catalog = $this->CircleModel->getListByPage($pageSize, $pageIndex, $strWhere, $orderBy); $page = new Page(); $str_page = $page->create($pageIndex, $pageSize, $totalCount, array(), array()); $data = array('page' => $str_page, 'catalog' => $catalog); $this->load->view('Catalog/list', $data); }
/** * 默认函数 * Enter description here ... */ public function index() { $pageSize = 12; $pageIndex = $this->input->get('page') ? $this->input->get('page') : 1; $strWhere = ''; $orderBy = ''; $totalCount = $this->FamousModel->getListCountByWhere($strWhere); $famous = $this->FamousModel->getListByPage($pageSize, $pageIndex, $strWhere, $orderBy); $page = new Page(); $str_page = $page->create($pageIndex, $pageSize, $totalCount, array(), array()); $data = array('page' => $str_page, 'famous' => $famous); $this->load->view('Famous/list', $data); }
/** * Creates a page from the given input data * * @param array $input * @return DvsPage */ protected function createPageFromInput($input) { // fill in some default values $input = array_only($input, static::$PageFields); $input['is_admin'] = array_get($input, 'is_admin', false); $input['dvs_admin'] = array_get($input, 'dvs_admin', false); $input['language_id'] = array_get($input, 'language_id', $this->Config->get('devise.languages.primary_language_id')); $input['route_name'] = $this->findAvailableRoute(Str::slug(array_get($input, 'title', str_random(42))), $input['language_id']); if ($this->isValidInputForNewPage($input)) { return $this->Page->create($input); } return false; }
/** * 默认函数 * Enter description here ... */ public function index() { $pageSize = 12; $pageIndex = $this->input->get('page') ? $this->input->get('page') : 1; $strWhere = 'a.is_del<>1'; $orderBy = ''; $totalCount = $this->CommentModel->getListCountByWhere($strWhere); $comment = $this->CommentModel->getListByPage($pageSize, $pageIndex, $strWhere, $orderBy); $page = new Page(); $str_page = $page->create($pageIndex, $pageSize, $totalCount, array(), array()); $data = array('page' => $str_page, 'comment' => $comment); $this->load->view('Comment/list', $data); }
/** * 回收站函数 * Enter description here ... */ public function rubbish() { $pageSize = 12; $pageIndex = $this->input->get('page') ? $this->input->get('page') : 1; $strWhere = 'a.is_del =1'; $orderBy = ''; $totalCount = $this->PostModel->getListCountByWhere($strWhere); $post = $this->PostModel->getListByPage($pageSize, $pageIndex, $strWhere, $orderBy); $page = new Page(); $str_page = $page->create($pageIndex, $pageSize, $totalCount, array(), array()); $data = array('page' => $str_page, 'post' => $post); $this->load->view('Post/rubbish_list', $data); }
/** * Alternatively creates plain pages for faxing and printing */ function create() { if ($this->mode != 'pwlist-print') { return parent::create(); } // very plain page for faxing header('Content-Type: text/html; charset=UTF-8', true); $cont = "<html><center>"; $cont .= $this->createGroupSelector($_GET['groupname'], "pwlist.php"); $cont .= $this->passwordTable(); $cont .= "</center></html>"; return $cont; }
/** * Check if subpage's folder is a subfolder of parent page */ public function testHierarchy() { $parent = $this->objFromFixture('Page', 'parentpage'); $child = $this->objFromFixture('Page', 'subpage'); //test if fixtures are set up properly $this->assertEquals($parent->ID, $child->ParentID, 'subpage should be a child of parentpage'); $this->assertEquals($parent->RootFolderID, $child->RootFolder()->ParentID, 'rootfolder2 should be a child of rootfolder 1'); $newPage = Page::create(); $newPage->ParentID = $parent->ID; $newPage->Title = 'Hierarchy Test'; $newPage->urlSegment = 'hierarchy-test'; $newPage->write(); $this->assertEquals($parent->RootFolderID, $newPage->RootFolder()->ParentID, 'new folder should be a child of page1 folder'); }
/** * 默认函数 * Enter description here ... */ public function index() { $pageSize = 5; $pageIndex = $this->input->get('page') ? $this->input->get('page') : 1; $selParam = "a.section_name as asection_name,b.*"; $dataSet = "dx_section a INNER JOIN dx_section b ON a.id = b.pid"; $strWhere = "a.id = 3 and b.grade = 3"; $orderBy = ''; $totalCount = $this->PartyIntroModel->getListCountByWhere($dataSet, $strWhere); $PartyIntro = $this->PartyIntroModel->getListByPage($pageSize, $pageIndex, $selParam, $dataSet, $strWhere, $orderBy); $page = new Page(); $str_page = $page->create($pageIndex, $pageSize, $totalCount, array(), array()); $data = array('page' => $str_page, 'PartyIntro' => $PartyIntro); $this->load->view('PartyIntro/list', $data); }