public static function run() { !defined('APPROOT') && define('APPROOT', '../App/'); sc(['debug' => dc('debug'), 'error_reporting' => dc('error_reporting'), 'mcaroot' => dc('mcaroot')]); // 应用到类 // set_error_handler(array('App\Application', 'my_error_handler')); // 示例的做法 /* |------------------------------------------------ | 错误抑制 |------------------------------------------------ */ if (sc('debug')) { //错误报告 ini_set('error_reporting', sc('error_reporting')); } else { //不报告任何错误 error_reporting(0); } /* |------------------------------------------------ | 初始化 App/Config/Config.php |------------------------------------------------ */ sapp('ap')->Middleware(['SysMiddlewareConfigini' => \Grace\Middleware\SysMiddlewareConfigini::class, 'SysMiddlewareEnvini' => \Grace\Middleware\SysMiddlewareEnvini::class, 'SysMiddlewareRouter' => \Grace\Middleware\SysMiddlewareRouter::class, 'SysMiddlewareBusbuild' => \Grace\Middleware\SysMiddlewareBusbuild::class]); //D(sc()); //D(dc()); //debug = false 的时候置空 /* -> 获得底层数据sc |------------------------------------------------ | 初始化 App/Config/Config.php |------------------------------------------------ | 开始释放控制权 */ self::DoController(); }
public function terminate($request = null) { $dc = dc(); unset($dc['debug']); unset($dc['error_reporting']); unset($dc['App']); unset($dc['Env']); unset($dc['Module']['App']); unset($dc['Module']['Env']); unset($dc['Middleware']); unset($dc['Module']['Middleware']); unset($dc['Modulelist']); unset($dc['ActionExt']); unset($dc['Req']); unset($dc['Vo']); unset($dc['Usertable']); unset($dc['mcaroot']); unset($dc['Environment']); unset($dc['_page']); sc('Lb', $dc); //ok 完成了sc 的建立 //unset(dc()); //注销dc if (sc('debug')) { $this->res['end'] = $request; //记录结果数据 } else { \Sham\Wise\Wise::getInstance()->_configdc = array(); //值置空 } //return $request; }
public function handle($request, \Closure $next) { // Perform action /* |------------------------------------------------ | 载入系统初始化信息 Vo.config.php初始化 App/Config/Config.php |------------------------------------------------ */ //载入模块配置信息 dc('Vo', config('Vo.config')); //vc() 获取 //环境信息 dc('Environment', \Grace\Environment::getInstance()->all()); //get / post 信息 $res['get'] = sapp('req')->get; $res['post'] = sapp('req')->post; dc('Req', $res); /* |-------------------------------------------------------- | 模块信息 / 根据根据get post 获取 |-------------------------------------------------------- */ // if (dc('Req')['get']['m']) { //修改fc 记录用户config $file = rtrim(APPROOT, '/') . '/Modules/' . dc('Modulelist')[dc('Req')['get']['m']] . '/Conf.php'; $config = $this->load($file); //对跟配置进行重写 foreach ($config as $key => $value) { dc($key, $value); } //dc('Module',$config); } return $next($request); }
public function __call($name, $arguments) { return $this; dc($arguments); // TODO: Implement __call() method. return "" . $name . ""; }
function list_cats() { db_conn('crm'); $Sl = "SELECT * FROM tcats WHERE div='" . USER_DIV . "' ORDER BY name"; $Ry = db_exec($Sl) or errDie("Unable to list teams."); if (pg_numrows($Ry) < 1) { dc(); $Sl = "SELECT * FROM tcats WHERE div='" . USER_DIV . "' ORDER BY name"; $Ry = db_exec($Sl) or errDie("Unable to list teams."); } $out = "<h3>Query Categories</h3>\r\n\t<table cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\r\n\t<tr><th>Name</th><th>Description</th><th colspan=2>Options</th></tr>"; $i = 0; while ($tcatdata = pg_fetch_array($Ry)) { $i++; $out .= "<tr class='" . bg_class() . "'><td>{$tcatdata['name']}</td><td>{$tcatdata['des']}</td><td><a href='tcat-edit.php?id={$tcatdata['id']}'>Edit</a></td><td><a href='tcat-rem.php?id={$tcatdata['id']}'>Remove</a></td></tr>"; } $out .= "</table>"; return $out; }
public function attributesUIT() { // the attributes method replaces the :attribute placeholder on the validation messages // with given attribute names // You can use the trans(...) helper function here to get your 'localized' from // resources/lang/{language}/{file} // set your default and fallback locale in the config/app.php file // I will assume you are using English ('en') // the next one will look in resources/lang/en/attributes.php // for a other_field key $keynl = 'nl'; $keyen = 'en'; // $sitemap_translation_validation = array(); $sitemap_translation_validation = ['name.' . $keynl . '' => trans('validation.attributes.sitemap_name_nl'), 'slug.' . $keynl . '' => trans('validation.attributes.sitemap_slug_nl'), 'name.' . $keyen . '' => trans('validation.attributes.sitemap_name_en'), 'slug.' . $keyen . '' => trans('validation.attributes.sitemap_slug_en')]; //$sitemap_translation_validation = $sitemap_translation_validation[0]; // $test = ['system_name' => 'SYSTEM NAME fancy field name']; $test = array_merge($test, $sitemap_translation_validation); return $test; dc($test); dc($sitemap_translation_validation); }
public function getOnlineSitemapsTranslationBySitemapCategoryIdAndPaginate($sitemap_category_id, $paginate = 10) { //dc($slug.','.$depth.','.$parent_id); $sitemap = Sitemap::with(['categories.translation' => function ($q) { // 1 query for photos with... //$q->paginate(5); //$q->where('sitemap_category_id',40); //$q->whereHas('locale', function ($q) { // ...1 subquery to filter the photos by related tags' name // $q->where('languageCode', '' . app()->getLocale() . ''); //$q->where('status', 'enabled'); //}); }])->where('id', $sitemap_category_id)->where('status', 'online')->orderBy('order_by_number', 'asc')->firstOrFail(); //dc($sitemap); $sitemap = $sitemap->categoriesTest()->paginate($paginate); dc($sitemap); //->paginate(5); //->firstOrFail(); //dc($sitemap); /* $sitemap = Sitemap::with(['translation','template']) ->where('parent_id',$parent_id) ->where('id',$sitemap_category_id) ->where('status','online') ->orderBy('order_by_number', 'asc') //->get(); ->paginate(5); */ return $sitemap; }
private function resetKeyTranslationCollectionByLocaleIdentifierUIT($post) { dc($this->enabledLocales); foreach ($this->enabledLocales as $key => $enabledLocale) { if (isset($post[$key])) { //fout //$post[$enabledLocale->identifier] = $post[$key];// $post[$post[$key]->locale->identifier] = $post[$key]; //GOED! unset($post[$key]); } else { //new enabled locale after created sitemapTranslation //dc('RET sasdf'); /* $post[$enabledLocale->identifier] = new SitemapTranslation(); $post[$enabledLocale->identifier]->sitemap_id = $sitemap->id; $post[$enabledLocale->identifier]->locale_id = $enabledLocale->id; $post[$enabledLocale->identifier]->name = 'new name, new enabled locale '.$enabledLocale->identifier.''; $post[$enabledLocale->identifier]->slug = 'new slug, new enabled locale '.$enabledLocale->identifier.''; */ } } return $post; }
public function indexHome(Request $request) { //$references = Sitemap::with([ // 'references.componentsTest', // 'references.translation'])->where('id',36); //dc($references->get()); //return "view"; $this->sitemap->initWebPage(); $navigation = $this->sitemap->getWebpageNavigation(); $sitemap = $this->sitemap->getWebpageContent(); //dc($navigation[1]); $breadcrumb = $this->sitemap->getBreadcrumbArray(); $breadcrumbHTML = $this->sitemap->getBreadcrumbHTML(); //dc($breadcrumbHTML); $sitemapList = $this->sitemap->getWebPageSitemapList(); $pagination = $sitemapList instanceof LengthAwarePaginator; //dc($sitemapList); if (!is_null($sitemapList)) { foreach ($sitemapList as $key => $sitemapListItem) { //if ($key == 0){ $this->sitemap->groupMediaTranslationCollectionByFieldName($sitemapListItem->translation); //} } } $this->sitemap->groupMediaTranslationCollectionByFieldName($sitemap->translation); //dc($sitemap); //$template = Sitemap::with('template')->findOrFail($id)->template; //dc($sitemap->references); //dc($sitemapList); //dc($sitemapList[0]->translation->media['intro']); //foreach ($sitemapList[0]->translation->media['intro'] as $key => $image){ // dc($key); //} //$this->sitemap->groupMediaCollectionByFieldName($sitemap->translations); //dc($test); //dc($navigation[0]); foreach ($navigation[0] as $key => $nav) { // dc($nav->translation->name.' - '.$nav->selected.' - '.$nav->hasChildren); } return view('index', compact('sitemap', 'navigation', 'breadcrumb', 'breadcrumbHTML', 'sitemapList', 'pagination')); //dc($breadcrumb[0]->template->name); $test = ''; foreach ($breadcrumb as $key => $breadcrumbItem) { // $test .= ($breadcrumbItem->translation->name.' - '); } dc($breadcrumb); dc($sitemap->translation->name); /* foreach($navigation as $key => $nav){ foreach($nav as $key1 => $nav1){ dc($nav1->translation->name.' - '.$nav1->selected.' - '.$nav1->no_sitemap_parents); //dc($nav1->selected); //dc($nav1->no_sitemap_parents); } dc('end'); } */ return "view"; //dc($test); //dc($breadcrumb); //dc($navigation); //dc($sitemapList); /* * GOED $ */ //$navigation[0][0]->setAttribute('selected',true); //dc($navigation[0][1]->getAttributes()); //dc($navigation[0][1]); //dc($navigation[0][1]->selected); /* foreach ($navigation[2] as $key => $nav){ dc($nav->translation->name); dc($nav->selected); dc($nav->no_sitemap_parents); } foreach ($navigation as $key => $nav){ dc($nav); } dc($navigation); */ //$test = $this->sitemap->getOnlineSitemapsTranslationByParentIdAndSitemapCategory(40); //dc($test[0]->categoriesTest); //foreach ($test[0]->categoriesTest as $cat){ // dc($cat->translation->name); //} //dc($breadcrumb[0]->translation->slug); return view('index', compact('sitemap', 'navigation', 'breadcrumb', 'sitemapList')); return "view"; //dc($request->path()); //dc($request); //dc($request->path()); if ($request->path() != "/") { //dc($requestUriArray); $sitemap = $this->sitemap->getSitemapByUrl(); dc($sitemap->id); $navigation = $this->sitemap->getNavigation(); $breadcrumb = $this->sitemap->getBreadcrumb(); //return "view"; //dc($sitemap); dc($breadcrumb); dc('test'); } else { $sitemapId = 1; $sitemap = $this->sitemap->getSitemapForIndex($sitemapId); } return "view"; //return view('index-amp',compact('sitemap','testComposer')); return view('index', compact('sitemap', 'navigation', 'breadcrumb')); //todo post_type nodig, JA DUS VOOR POST REQUEST $id = $request->route()->parameter('id') ? $request->route()->parameter('id') : null; //$post_type = $request->route()->parameter('post_type') ? $request->route()->parameter('post_type') : null; //if (is_null($post_type)){ // $template = Sitemap::with('template')->findOrFail($id)->template; // $post_type = Sitemap::with('template')->findOrFail($id)->template->db_table_name; //} $id = 1; $template = Sitemap::with('template')->findOrFail($id)->template; //todo $allowedParentSitemaps = $this->sitemap->getAllowedParentSitemapsByTemplate($template); $sitemap_list = $this->sitemap->getParentSitemapList($allowedParentSitemaps); $enabledLocales = $this->sitemap->getEnabledLocales(); $sitemap = $this->sitemap->getSelectedSitemap($id, $template); $sitemap = $this->sitemap->setSelectedReferencesBySitemap($sitemap); $this->sitemap->groupMediaCollectionByFieldName($sitemap->translations); //kan weg geen templates wijzigen $template_list = Template::lists('name', 'id'); $template = $sitemap->template; //dc($template); $status_list = collect(['online' => 'Online', 'pending_review' => 'Wacht op review', 'concept' => 'Concept']); //dc($sitemap); $post_type = $template->slug; //voor PostRequest return view('index', compact('sitemap', 'post_type', 'template', 'enabledLocales', 'template_list', 'sitemap_list', 'status_list')); //return view('admin.sitemap.edit',compact('sitemap','post_type','template','enabledLocales','template_list','sitemap_list','status_list')); }
/** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(SitemapRequest $request, $id) { //get sitemap order_by_number if ($request->get('order_by_number') == '0') { $siblings_of_updated_sitemap = Sitemap::where('parent_id', $request->get('parent_id'))->get(); //dc($siblings_of_updated_sitemap); $sitemap_order_by_number = $siblings_of_updated_sitemap->max('order_by_number') + 1; //null+1 = 1 //dc($sitemap_order_by_number); $request->merge(array('order_by_number' => $sitemap_order_by_number)); } //get sitemap depth if ($request->get('depth') == '') { $sitemap_depth = Sitemap::where('id', $request->get('parent_id'))->first()->depth + 1; $request->merge(array('depth' => $sitemap_depth)); } //dc($sitemap_order_by_number); //dc($sitemap_depth); //return "view"; //return "view"; $request->merge(array('updated_by_user_id' => auth()->user()->id)); DB::transaction(function () use($request, $id) { try { $enabledLocales = $this->sitemap->getEnabledLocales(); $template = Sitemap::with('template')->findOrFail($id)->template; //todo to much sql $sitemap = $this->sitemap->getSelectedSitemap($id, $template); $sitemap->update($request->all()); //sitemapCategory[locatie][] //dc($sitemap->categories); if ($request->has('sitemapCategory')) { $syncArray = []; //dc('test'); foreach ($request['sitemapCategory'] as $formName => $formValue) { //dc($formName); //dc($formValue); $cnt = 1; $sitemap->categories()->where('category', $formName)->delete(); //$flight->delete(); //$sitemap->categories()->destroy(1); foreach ($formValue as $key2 => $sitemap_category_id) { //echo $mediatranslation_id; $syncArray = ['sitemap_id' => $id, 'sitemap_category_id' => (int) $sitemap_category_id, 'category' => $formName, 'order_by_number' => $cnt++]; $sitemap->categories()->insert($syncArray); } } } //$sitemap->touch(); //$sitemap->timestamp('updated_at')->useCurrent(); foreach ($enabledLocales as $key => $enabledLocale) { $localeRequest = array_add($request->translations[$enabledLocale->languageCode], 'locale_id', $enabledLocale->id); //translation //make slug from name if ($sitemap->id != 1) { $localeRequest['slug'] = str_slug($request->translations[$enabledLocale->languageCode]['name']); } else { $localeRequest['slug'] = ""; } if (isset($localeRequest['content'])) { $localeRequest['content'] = clean($request->translations[$enabledLocale->languageCode]['content']); } $sitemap->translations[$enabledLocale->languageCode]->update($localeRequest); //translation->template $localeRequest[$template->slug]['content'] = clean($localeRequest[$template->slug]['content']); //dc($template->slug); $sitemap->translations[$enabledLocale->languageCode]->{$template->slug}->update($localeRequest[$template->slug]); //mediatranslation $this->sitemap->syncThisTranslationMediaTranslation($sitemap->translations[$enabledLocale->languageCode]->id, $request->translations[$enabledLocale->languageCode], $sitemap->translations[$enabledLocale->languageCode]); } //update reference_sitemap if ($request->has('reference')) { $syncArray = []; $cnt = 1; foreach ($request->input('reference') as $key => $component_reference) { //dc($id); foreach ($component_reference as $component_id => $reference_id) { //dc($component_id." = ".$reference_id); $testArray[] = ['sitemap_id' => $id, 'reference_id' => $reference_id, 'component_id' => $component_id, 'order_by_number' => $cnt++]; } } $sitemap->references()->sync([]); //pivot 3 key $sitemap->references()->attach($testArray); } else { $sitemap->references()->sync([]); } Flash::success('Update is gelukt!'); } catch (\Exception $e) { if (request()->ajax()) { throw new \Exception('Updaten is niet gelukt.<br>SitemapController->update() <br>' . $e->getMessage() . ' '); } Flash::error('Update is mislukt! ' . $e->getMessage() . ''); dc($e); dd($e->getMessage()); return redirect()->back(); } }); //return "view"; return redirect()->back(); }
public function checkBoxListORG($name, $list = [], $selected = null, $options = []) { // When building a select box the "value" attribute is really the selected one // so we will use that when checking the model or session for a value which // should provide a convenient method of re-populating the forms on post. $selected = $this->getValueAttribute($name, $selected); $options['id'] = $this->getIdAttribute($name, $options); if (!isset($options['name'])) { $options['name'] = $name; } // We will simply loop through the options and build an HTML value for each of // them until we have an array of HTML declarations. Then we will join them // all together into one single HTML element that can be put on the form. $html = []; if (isset($options['placeholder'])) { $html[] = $this->placeholderOption($options['placeholder'], $selected); unset($options['placeholder']); } $test = []; foreach ($list as $value => $display) { $html[] = $this->getSelectOption($display, $value, $selected); $type = 'checkbox'; $selected = $this->getSelectedValue($value, $selected); $checked = $selected; $checked = $this->getCheckedState($type, $name, $value, $checked); $tmpClass = ''; if ($checked) { $options['checked'] = 'checked'; $tmpClass = ' active'; } //$test[] = "<label>".$this->input($type, $name, $value, $options)." ".$display."</label>"; $test[] = "<label class=\"form-checkbox form-normal form-primary" . $tmpClass . " form-text\">" . $this->input($type, $name, $value, $options) . " " . $display . "</label>\n"; unset($options['checked']); //$test[] = "name".$display."".$this->input($type, $name, $value, $options); } // Once we have all of this HTML, we can join this into a single element after // formatting the attributes into an HTML "attributes" string, then we will // build out a final select statement, which will contain all the values. $options = $this->html->attributes($options); $list = implode('', $html); $test = implode('', $test); return $this->toHtmlString("{$test}"); dc($list); //return $this->toHtmlString($test); //dc($this->toHtmlString("<select{$options}>{$list}</select>")); return $this->toHtmlString("<select{$options}>{$list}</select>"); }
private function xtestMorph() { //http://stackoverflow.com/questions/33189347/get-data-from-polymorphic-relations-with-namespaces //$medium->translations[$key]->{$medium_type.'s'}->update //STORE //https://laracasts.com/discuss/channels/eloquent/multiple-polymorphic-relationships-with-the-same-controller $u = collect(['provider' => 'updateproviderNEW1234']); $this->testUpdate(121, $u); //image $u = collect(['application' => 'updateApplicationNEW1234']); $this->testUpdate(122, $u); //file dc(Media\Image::class); dc(Media\File::class); dc(Media\Video::class); return "views"; $mt = Mediatranslation::find(121); //image $u = collect(['provider' => 'updateproviderNEW']); dc($mt->mediable()->update($u->all())); $this->testUpdate(121, $u); //image $u = collect(['application' => 'updateApplicationNEW']); $this->testUpdate(122, $u); //file $mt1 = MediaTranslation::find(122); //file //dc($mt1); $u = collect(['application' => 'updateApplicationNEW']); dc($mt1->mediable()->update($u->all())); //$mt = Mediatranslation::with(['mediable'])->where('id',121)->first(); //dc($mt->mediable); $mt1 = Mediatranslation::with(['mediable'])->where('id', 122)->first(); dc($mt1->mediable); $mt1 = Mediatranslation::with(['mediable'])->where('id', 121)->first(); dc($mt1->mediable); return "view"; $test = Mediatranslation::with(['image'])->where('id', 121)->get()->all(); //dc($test); $img = Image::with(['media'])->get(); //dc($img); foreach ($img as $image) { // dc($image->media); } return 'view'; return "view"; //$mt = Mediatranslation::with('mediable')->get(); $mt = Mediatranslation::with('mediable')->whereIn('id', ['121', '122'])->get(); foreach ($mt as $t) { //dc($t->mediable->orientation); dc(class_basename($t->mediable)); } //dc($mt->first()->mediable); return "view"; $mt = Mediatranslation::with('mediable')->whereIn('id', ['121', '122']); dc($mt->get()); return "view"; $media = Media::find(31); $media = $media->translation->mediable(); dc($media->getResults()); dc('-----'); $mediaTranslation = MediaTranslation::find(122); //dc($mediaTranslation); $mediable = $mediaTranslation->mediable(); dc($mediable->getResults()); $image = Image::find(62); dc($image->media()->getResults()); //foreach ($staff->photos as $photo) { // //} return "view"; }
function dd($data, $label = NULL, $die = FALSE) { return dc($data, $label, TRUE); }
/** * Prints a dump of the public, protected and private properties of $var and dies * * Uses custom defaults: $maxDepth defaults to 3 and $stripTags * defaults to false. * * @link http://xdebug.org/ * * @param mixed $var The variable to dump. * @param integer $maxDepth The maximum nesting level for object properties. * @param boolean $stripTags Whether output should strip HTML tags. */ function dcd($var, $maxDepth = 3, $stripTags = false) { dc($var, $maxDepth, $stripTags); die; }
public function getpath() { $path = \Grace\Environment::getInstance()->all()['path']; $path = trim($path, '/'); $v = array(); $v['m'] = ''; //模块 $v['c'] = ''; //控制器 $v['a'] = ''; //方法 $v['e'] = ''; //扩展方法 $v['_param'] = ''; //快捷参数 $_path = explode('/', $path); foreach ($_path as $k => $value) { if (empty($value)) { unset($_path[$k]); } } reset($_path); if (current($_path) == 'index.php') { array_shift($_path); } if (isset(dc('Modulelist')[current($_path)])) { $v['m'] = current($_path); array_shift($_path); } $v['c'] = array_shift($_path); $v['a'] = array_shift($_path); if (in_array(current($_path), dc('ActionExt'))) { $v['e'] = current($_path); array_shift($_path); } $_params = array(); if (count($_path) == 1) { $v['_param'] = current($_path); array_shift($_path); } else { //============================================== //计算params //D($pq_); $_params = []; $count = ceil(count($_path) / 2); for ($i = 0; $i < $count; $i++) { $ii = $i * 2; isset($_path[$ii + 1]) && ($_params[$_path[$ii]] = $_path[$ii + 1]); } //============================================== } $v['params'] = $_params; //这个是path后面的参数 return $v; }
settings()->merge(['fooxx'=>'fooValue']); dd(settings()->all()); //goed settings('foo'); $user = \WI\User\User::first(); dc($user->settings->foo); return view('welcome'); */ //}); Route::get('/settings', function () { $test = settings()->merge(Request::all()); return response()->json($test); dc($test); //$test->get('foo'); //dc(settings()->get('foo')); //return "view"; //response()->json($test); //dc($test); //\WI\User\User::first()->settings()->merge(Request::all()); //return redirect('/'); }); #Route::auth(); //Login/logout Routes... $this->get('login', ['as' => 'login', 'uses' => 'Auth\\AuthController@showLoginForm']); $this->post('login', ['as' => '', 'uses' => 'Auth\\AuthController@login']); $this->get('logout', ['as' => 'logout', 'uses' => 'Auth\\AuthController@logout']); // Password Reset Routes... $this->post('password/email', ['as' => '', 'uses' => 'Auth\\PasswordController@sendResetLinkEmail']);