public function getEstadisticos() { setlocale(LC_TIME, 'spanish'); $mes = strftime("%B", mktime(0, 0, 0, date('m'), 1, 2000)); $anio = date('Y'); $pagos = Pago::where(DB::raw('YEAR(created_at)'), '=', date('Y'))->where(DB::raw('MONTH(created_at)'), '=', date('m'))->where('cancelado', 0)->sum('monto'); $ventas = Venta::where(DB::raw('YEAR(fecha)'), '=', date('Y'))->where(DB::raw('MONTH(fecha)'), '=', date('m'))->where('cancelada', 0)->where('cotizacion', 0)->where('autorizado', 1)->groupby(DB::raw('YEAR(fecha)'), DB::raw('MONTH(fecha)'))->orderby('fecha')->sum('total'); return Response::json(array("ventas" => number_format($ventas, 0, ".", ","), "ingresos" => number_format($pagos, 0, ".", ","), "mes" => Str::title($mes) . ' de ' . $anio)); }
public function post_deleteGroup() { $groupid = Input::get('groupid'); $name = Input::get('name'); Group::getDataModel($groupid); $existed = Group::checkData(); if (!$existed) { Group::find($groupid)->delete(); Log::write('Data', 'Data Group<b>' . $name . '</b> Remove by ' . Auth::user()->username); return json_encode(Group::listData()); } else { return json_encode(array('fail' => Str::title(Lang::line('admin.deletegroupfail')->get()))); } }
/** * breadcrumb function * Create breadcrumb * @return string * @author joharijumali **/ public static function breadcrumb() { $Menu = Admin_Menu::menuGenerator(); $butternbread = array(); foreach ($Menu as $floor => $packet) { foreach ($packet->page->action as $key => $action) { if ($packet->packet == Str::lower(URI::segment(1)) && $packet->controller->name == Str::lower(URI::segment(2)) && $action->name == Str::lower(URI::segment(3)) || URI::segment(3) == NULL && $action->name == $packet->controller->name && Str::lower(URI::segment(2)) == $packet->controller->name) { $butternbread[Str::upper($packet->controller->alias)] = '#'; array_push($butternbread, Str::title($action->alias)); } } } return Breadcrumb::create($butternbread); }
public static function render() { $rolelist = Admin_UserRole::all(); $page = Acltree::datasource(); //all(); $acl = Admin_UserAcl::aclRegistered(); $content = array(); $fot = 1; foreach ($rolelist as $role) { $subcontent = '<h3>' . Str::upper($role->role . " Setup") . '</h3>'; $subcontent .= '<ul class="nav nav-list">'; foreach ($page as $controller => $selection) { $subcontent .= '<li class="nav-header"><i class="icon-hdd"></i> ' . Str::upper($selection['alias']) . '</li>'; $subcontent .= '<div class="row-fluid">'; foreach ($selection['page'] as $action => $alias) { $subcontent .= '<span style="padding-right:5px;width:auto;">'; $subcontent .= Form::hidden($role->role . '[id]', $role->roleid); if (in_array($role->roleid, array_keys($acl)) && in_array($controller, array_keys($acl[$role->roleid])) && in_array($action, array_keys($acl[$role->roleid][$controller])) && $acl[$role->roleid][$controller][$action] == true) { $subcontent .= Form::inline_labelled_checkbox($role->role . '[' . $controller . '][' . $action . ']', Str::title($alias), null, array('checked' => true, 'style' => 'padding:2px')); } else { $subcontent .= Form::inline_labelled_checkbox($role->role . '[' . $controller . '][' . $action . ']', $alias); } $subcontent .= '</span>'; } $subcontent .= '</div >'; $subcontent .= '<li class="divider"></li>'; } $subcontent .= '</ul>'; $active = $fot == 1 ? true : false; $fot++; array_push($content, array(Str::upper($role->role), $subcontent, $active)); } $nav = Navigation::links($content); $tab = Tabbable::tabs_left($nav); return $tab; }
public static function get_extra($module_slug) { $all_fields = self::where('module_slug', '=', $module_slug)->get(); // Get all groups (Tabs) $groups = array(); foreach ($all_fields as $field) { if (empty($field->value)) { $field->value = $field->default; } if (!isset($groups[$field->group])) { $groups[$field->group] = \Str::title(str_replace('_', ' ', $field->group)); } // The field option is a function? if it is grab // what is needed func:\Navigation\Groups::title,slug if (starts_with($field->value, 'func:')) { $func = substr($field->value, 5); $func_parts = explode('.', $func); $arr = array('*'); if (isset($func_parts['1'])) { $arr = explode(',', $func_parts['1']); } $options_raw = call_user_func($func_parts['0'], $arr); // Build options array // array('header' => Header) (navigation) example $options = array(); if (count($arr) > 1) { foreach ($options_raw as $opt) { $options[$opt->{$arr['0']}] = $opt->{$arr['1']}; } } $field->value = $options; } } $response = array('groups' => $groups, 'fields' => $all_fields); return $response; }
<?php // History Breadcrumbs::register('admin.history.index', function (\DaveJamesMiller\Breadcrumbs\Generator $breadcrumbs) { $breadcrumbs->parent('dashboard'); $breadcrumbs->push(Str::title(trans('history::global.name')), route('admin.history.index')); }); Breadcrumbs::register('admin.history.edit', function (\DaveJamesMiller\Breadcrumbs\Generator $breadcrumbs, \TypiCMS\Modules\History\Models\History $history) { $breadcrumbs->parent('admin.history.index'); $breadcrumbs->push($history->title, route('admin.history.edit', $history->id)); }); Breadcrumbs::register('admin.history.create', function (\DaveJamesMiller\Breadcrumbs\Generator $breadcrumbs) { $breadcrumbs->parent('admin.history.index'); $breadcrumbs->push(trans('history::global.New'), route('admin.history.create')); });
public function updateConfigure() { if (Input::has('pk')) { if (!Request::ajax()) { return App::abort(404); } return self::updateQuickEdit(); } else { if (Request::ajax()) { $arrReturn = ['status' => 'error']; $configure = new Configure(); $configure->cname = Input::get('cname'); $configure->ckey = Input::get('ckey'); if (Input::hasFile('cvalue')) { $path = app_path('files'); if (!File::exists($path)) { File::makeDirectory($path, 493, true); } $path = str_replace(['\\', '/'], DS, $path); $file = Input::file('cvalue'); $file->move($path, $configure->ckey . '.' . $file->getClientOriginalExtension()); $configure->cvalue = $path . DS . $configure->ckey . '.' . $file->getClientOriginalExtension(); } else { $configure->cvalue = Input::get('cvalue'); } $configure->cdescription = Input::get('cdescription'); $configure->active = Input::has('active') ? 1 : 0; $pass = $configure->valid(); if ($pass) { $configure->save(); $arrReturn = ['status' => 'ok']; $arrReturn['message'] = $configure->cname . ' has been saved'; $arrReturn['data'] = $configure; } else { $arrReturn['message'] = ''; $arrErr = $pass->messages()->all(); foreach ($arrErr as $value) { $arrReturn['message'] .= "{$value}\n"; } } $response = Response::json($arrReturn); $response->header('Content-Type', 'application/json'); return $response; } } $arrPost = Input::all(); unset($arrPost['_token']); foreach ($arrPost as $key => $value) { if (in_array($key, ['main_logo', 'favicon'])) { if (!Input::hasFile($key)) { continue; } if ($key == 'main_logo') { $path = public_path('assets' . DS . 'images' . DS . 'logos'); $width = 400; $name = 'logo'; } else { if ($key == 'favicon') { $path = public_path('assets' . DS . 'images' . DS . 'favicons'); $width = 16; $name = 'favicon'; } } $configure = Configure::firstOrNew(['ckey' => $key]); $configure->ckey = $key; $configure->cname = Str::title(str_replace('_', ' ', $key)); if (!empty($configure->cvalue) && File::exists(public_path($configure->cvalue))) { File::delete(public_path($configure->cvalue)); } $path = VIImage::upload(Input::file($key), $path, $width, false, $name); $path = str_replace(public_path() . DS, '', $path); $configure->cvalue = str_replace(DS, '/', $path); $configure->save(); } else { $configure = Configure::firstOrNew(['ckey' => $key]); $configure->ckey = $key; $configure->cname = Str::title(str_replace('_', ' ', $key)); $configure->cvalue = $value; $configure->save(); if ($key == 'mask') { Cache::tags('images')->flush(); Cache::forever('mask', $value); } } } return Redirect::to(URL . '/admin/configures')->with('flash_success', 'Main Configure has been saved.'); }
<?php // Partners breadcrumbs Breadcrumbs::register('admin.partners.index', function (\DaveJamesMiller\Breadcrumbs\Generator $breadcrumbs) { $breadcrumbs->parent('dashboard'); $breadcrumbs->push(Str::title(trans('partners::global.name')), route('admin.partners.index')); }); Breadcrumbs::register('admin.partners.edit', function (\DaveJamesMiller\Breadcrumbs\Generator $breadcrumbs, \TypiCMS\Modules\Partners\Models\Partner $partner) { $breadcrumbs->parent('admin.partners.index'); $breadcrumbs->push($partner->title, route('admin.partners.edit', $partner->id)); }); Breadcrumbs::register('admin.partners.create', function (\DaveJamesMiller\Breadcrumbs\Generator $breadcrumbs) { $breadcrumbs->parent('admin.partners.index'); $breadcrumbs->push(trans('partners::global.New'), route('admin.partners.create')); });
public static function generate() { $admin = Arcone::getadministrator(); $totalStruct = $struct = Arcone::getstructures(); $structModeling = Admin_ModulPage::getRegPages(); $totalStruct = Arcone::getallstructures(); $view = '<ul class="nav nav-list">'; foreach ($totalStruct as $modul => $content) { if (!empty($structModeling[$modul])) { $view .= '<li class="nav-header alert alert-info"><i class="icon-hdd"></i> ' . Str::upper($modul) . '</li>'; $view .= Form::hidden($modul . '[id]'); $registered = !empty($structModeling[$modul]) ? 'alert alert-success' : 'alert'; $view .= '<li class="' . $registered . '">'; $idiv = count($content); foreach ($content as $submodul => $subcontent) { if (isset($structModeling[$modul][$submodul])) { $view .= '<ul class="nav nav-list">'; $view .= '<li style="height:30px" ><i class="icon-folder-close"></i> ' . Str::title($submodul); $submodulID = isset($structModeling[$modul][$submodul]) ? $structModeling[$modul][$submodul]['modulpageid'] : null; $view .= Form::hidden($modul . '[' . $submodul . '][id]', $submodulID); // $view .= '<div class="span6 form-inline pull-right" >'; // $submodulArrg = isset($structModeling[$modul][$submodul])?$structModeling[$modul][$submodul]['arrangement']:null; // $view .= Form::mini_text($modul.'['.$submodul.'][arrangement]', $submodulArrg , array('class' => 'input-small', // 'style'=>'height:10px;width:10px;box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);background:none repeat scroll 0 0 rgba(0, 0, 0, 0.2);color:#fff','placeholder' => '#')); // $submodulAlias = isset($structModeling[$modul][$submodul])? $structModeling[$modul][$submodul]['controlleralias']:''; // $view .= Form::mini_text($modul.'['.$submodul.'][controlleralias]', $submodulAlias, array('class' => 'input-small','style'=>'height:10px;font-size:12px;','placeholder' => 'Alias')); // $view .= ' '; // $submodulVisible = isset($structModeling[$modul][$submodul])? $structModeling[$modul][$submodul]['visible']:0; // $submodulVisibleChecked = ($submodulVisible == 1)? array('checked') : array(); // $view .= Form::labelled_checkbox($modul.'['.$submodul.'][show]', '<em><small>Show</small></em>',null,$submodulVisibleChecked); // $view .= ' '; // $submodulAuth = isset($structModeling[$modul][$submodul])? $structModeling[$modul][$submodul]['auth']:0; // $submodulAuthChecked = ($submodulAuth == 1)? array('checked') : array(); // $view .= Form::labelled_checkbox($modul.'['.$submodul.'][auth]', '<em><small>Auth</small></em>',null,$submodulAuthChecked); // $view .= ' '; // $submodulAdmin = isset($structModeling[$modul][$submodul]['admin'])? $structModeling[$modul][$submodul]['admin']:0; // $submodulAdminChecked = ($submodulAdmin == 1)? array('checked') : array(); // $view .= Form::labelled_checkbox($modul.'['.$submodul.'][admin]', '<em><small>Admin Only</small></em>',null,$submodulAdminChecked); // $view .= ' '; // $view .= '</div>'; $view .= '</li>'; $arrayBal = array(); $view .= '<li ><ul class="nav nav-list">'; foreach ($subcontent as $action) { $registered = !isset($structModeling[$modul][$submodul][$action]) ? 'class ="alert" style="border:none;background-color:transparent;padding:0px;height:30px;margin-bottom:0px;" ' : 'style="height:30px" '; $view .= '<li ' . $registered . '>'; $view .= '<i class="icon-list-alt "></i> ' . Str::title($action) . ' <em><small>' . Str::title($modul . '/' . $submodul . '/' . $action) . '</small></em>'; $actionID = isset($structModeling[$modul][$submodul][$action]) ? $structModeling[$modul][$submodul][$action]['modulpageid'] : null; $view .= Form::hidden($modul . '[' . $submodul . '][' . $action . '][id]', $actionID); $view .= '<div class="span6 form-inline pull-right" >'; $actionArrg = isset($structModeling[$modul][$submodul][$action]) ? $structModeling[$modul][$submodul][$action]['arrangement'] : null; $view .= Form::mini_text($modul . '[' . $submodul . '][' . $action . '][arrangement]', $actionArrg, array('class' => 'input-small', 'style' => 'height:10px;width:10px', 'placeholder' => '#')); $actionAlias = isset($structModeling[$modul][$submodul][$action]) ? $structModeling[$modul][$submodul][$action]['actionalias'] : ''; $view .= Form::mini_text($modul . '[' . $submodul . '][' . $action . '][actionalias]', $actionAlias, array('class' => 'input-small', 'style' => 'height:10px;font-size:12px;', 'placeholder' => 'Alias')); $view .= ' '; $actionVisible = isset($structModeling[$modul][$submodul][$action]) ? $structModeling[$modul][$submodul][$action]['visible'] : 0; $actionVisibleChecked = $actionVisible == 1 ? array('checked') : array(); $view .= Form::labelled_checkbox($modul . '[' . $submodul . '][' . $action . '][show]', '<em><small>Show</small></em>', null, $actionVisibleChecked); $view .= ' '; $actionAuth = isset($structModeling[$modul][$submodul][$action]) ? $structModeling[$modul][$submodul][$action]['auth'] : 0; $actionAuthChecked = $actionAuth == 1 ? array('checked') : array(); $view .= Form::labelled_checkbox($modul . '[' . $submodul . '][' . $action . '][auth]', '<em><small>Auth</small></em>', null, $actionAuthChecked); $view .= ' '; $actionAdmin = isset($structModeling[$modul][$submodul][$action]) ? $structModeling[$modul][$submodul][$action]['admin'] : 0; $actionAdminChecked = $actionAdmin == 1 ? array('checked') : array(); $view .= Form::labelled_checkbox($modul . '[' . $submodul . '][' . $action . '][admin]', '<em><small>Admin Only</small></em>', null, $actionAdminChecked); $view .= ' '; $view .= '</div>'; $view .= '</li>'; unset($structModeling[$modul][$submodul][$action]); } $view .= '</ul></li>'; $idiv--; if ($idiv != 0) { $view .= '<li class="divider"></li>'; } unset($structModeling[$modul][$submodul]['modulpageid']); unset($structModeling[$modul][$submodul]['arrangement']); unset($structModeling[$modul][$submodul]['controlleralias']); unset($structModeling[$modul][$submodul]['visible']); unset($structModeling[$modul][$submodul]['auth']); unset($structModeling[$modul][$submodul]['admin']); unset($structModeling[$modul][$submodul]['header']); unset($structModeling[$modul][$submodul]['footer']); if (!empty($structModeling[$modul][$submodul])) { $view .= '<li class="alert-error">'; foreach ($structModeling[$modul][$submodul] as $deletedaction => $deletedcontent) { $view .= '<ul class="nav nav-list">'; $view .= '<li>'; $view .= '<i class="icon-remove"></i> ' . Str::title($deletedcontent['actionalias']) . ' <em>' . $modul . '/' . $submodul . '/' . $deletedaction . '</em>'; $view .= Form::hidden($modul . '[' . $submodul . '][' . $deletedaction . '][id]', $deletedcontent['modulpageid']); $view .= '<div class="span6 form-inline pull-right" >'; $view .= Form::labelled_checkbox($modul . '[' . $submodul . '][' . $deletedaction . '][remove]', '<em><small>Remove</small></em>'); $view .= '</div>'; $view .= '</li>'; $view .= '</ul >'; unset($structModeling[$modul][$submodul][$deletedaction]); } $view .= '</li>'; } $view .= '</ul>'; if (empty($structModeling[$modul][$submodul])) { unset($structModeling[$modul][$submodul]); unset($structModeling[$modul]['modulalias']); } } } $view .= '</li>'; if (empty($structModeling[$modul])) { unset($structModeling[$modul]); } } } if (!empty($structModeling)) { $view .= '<li class="divider"></li>'; foreach ($structModeling as $modulDeleted => $contentDeleted) { $view .= '<li class="nav-header alert alert-error"><i class="icon-hdd"></i> ' . Str::upper($modulDeleted) . '</li>'; unset($contentDeleted['modulalias']); $view .= '<li class="alert alert-error">'; $view .= '<ul class="nav nav-list">'; foreach ($contentDeleted as $submodulDeleted => $subcontentDeleted) { $view .= '<li style="height:30px;">'; $view .= '<i class="icon-remove"></i> ' . Str::title($subcontentDeleted['controlleralias']) . ' <em>' . $modulDeleted . '/' . $submodulDeleted . '</em>'; $view .= Form::hidden($modulDeleted . '[' . $submodulDeleted . '][id]', $subcontentDeleted['modulpageid']); $view .= '<div class="span6 form-inline pull-right" >'; $view .= Form::labelled_checkbox($modulDeleted . '[' . $submodulDeleted . '][remove]', '<em><small>Remove</small></em>'); $view .= '</div>'; $view .= '</li>'; unset($subcontentDeleted['controlleralias']); unset($subcontentDeleted['visible']); unset($subcontentDeleted['auth']); unset($subcontentDeleted['admin']); unset($subcontentDeleted['header']); unset($subcontentDeleted['footer']); unset($subcontentDeleted['arrangement']); unset($subcontentDeleted['modulpageid']); $view .= '<li >'; $view .= '<ul class="nav nav-list">'; foreach ($subcontentDeleted as $deletedaction => $deletedcontent) { $view .= '<li style="height:30px;">'; $view .= '<i class="icon-remove"></i> ' . Str::title($deletedcontent['actionalias']) . ' <em>' . $modulDeleted . '/' . $submodulDeleted . '/' . $deletedaction . '</em>'; $view .= Form::hidden($modulDeleted . '[' . $submodulDeleted . '][' . $deletedaction . '][id]', $deletedcontent['modulpageid']); $view .= '<div class="span6 form-inline pull-right" >'; $view .= Form::labelled_checkbox($modulDeleted . '[' . $submodulDeleted . '][' . $deletedaction . '][remove]', '<em><small>Remove</small></em>'); $view .= '</div>'; $view .= '</li>'; unset($structModeling[$modulDeleted][$submodulDeleted][$deletedaction]); } $view .= '</ul >'; $view .= '</li>'; } $view .= '</ul>'; $view .= '</li>'; } } $view .= '</ul>'; return $view; }
/** * Get the page's status * @return string */ public function status() { return Str::title($this->status); }
/** * Test the Str::title method. * * @group laravel */ public function testStringCanBeConvertedToTitleCase() { $this->assertEquals('Taylor', Str::title('taylor')); $this->assertEquals('Άχιστη', Str::title('άχιστη')); }
public function index_post($type) { $pageTitle = Str::title($type); $post_type = Post::post_type(); $data = Post::where('type', $type)->latest('id')->get(); return View::make('admin.post.ict_support', compact('data', 'pageTitle', 'post_type')); }
/** * Execute the console command. * * @return mixed */ public function fire() { // How many alerts to request from mongo $count = Config::get('kuu.cron_batch_size'); // KUU Email Settings $email_from_address = Config::get('kuu.email_from_address'); $email_from_name = Config::get('kuu.email_from_name'); $email_bcc = Config::get('kuu.email_bcc'); // time in seconds, how often to notify $alert_interval_24hrs = Config::get('kuu.alert_interval_24hrs'); // 20 mins $alert_interval_over_24hrs = Config::get('kuu.alert_interval_over_24hrs'); // a day $http_error_descriptions = Config::get('kuu.http_error_descriptions'); $url = Config::get('kuu.apiurl') . '/rest/popalerts?api_key=' . Config::get('kuu.apikey') . '&count=' . $count; $browser = new Buzz\Browser(); $response = $browser->get($url); $response_array = json_decode($response->getContent()); //$checkAlertEmail = new CheckAlertEmail(); if (isset($response_array->Result) && $response_array->Result == 'OK') { $mail_counter = 0; foreach ($response_array->Records as $record_id => $record) { $record->time_formatted = date("m/d H:i:s T", $record->timestamp - $record->downtime); $record->title = 'Site is ' . Str::title($record->type); // $this->info('Record '.print_r($record, TRUE)); $alert_emails = CheckAlertEmail::getAlertEmailsByMongoId($record->check_id); // $alert_emails = CheckAlertEmail::getAlertEmailsByMongoId('5357d420685fabd7490000a4'); // $this->info('Alert Emails '.print_r($alert_emails, TRUE)); //DB::select('SELECT * FROM checks LEFT JOIN checks_alert_email USING (check_id) // LEFT JOIN users ON checks_alert_email.user_id=users.id WHERE mongo_id = ?', // array('5322c33f3cdffe9926000099')); // array($record->check_id)); foreach ($alert_emails as $id => $email) { // $this->info('Alert email '.print_r($alert_emails, TRUE)); $since_last_time = time() - strtotime($email->last_sent . " GMT"); $times_sent = $email->times_sent; // $this->info('since_last_time '.$since_last_time.' '.$times_sent.' '.$alert_interval_24hrs.' '.$alert_interval_over_24hrs); // $this->info('down since '.$record->downtime.' '. (24*60*60) .'seconds in a day ' . $email_from_address.' '.$email_from_name); $isDown = $record->type == 'down'; $trigger_send = false; // if total downtime less than a day, use $alert_interval_24hrs, otherwise use if ($record->downtime < 24 * 60 * 60 && $since_last_time >= $alert_interval_24hrs) { $trigger_send = true; } elseif ($record->downtime >= 24 * 60 * 60 && $since_last_time >= $alert_interval_over_24hrs) { $trigger_send = true; } if ($trigger_send || !$isDown) { //$this->info($email->alert_email.' '.$email->first_name.' '.$email->last_name); $record->alert_email = $email; $record->protocol = $email->type; $record->http_error_descriptions = $http_error_descriptions; $email->subject = $record->title . " - " . $email->url . " - " . $email->type; $email->from_address = $email_from_address; $email->from_name = $email_from_name; $email->bcc_admin = $email_bcc; Mail::send('emails.cronalert', (array) $record, function ($message) use($email) { $message->from($email->from_address, $email->from_name); // Remove To email name, you can set alerts to go to 3rd parties, name won't be valid // $message->to($email->alert_email, $email->first_name.' '.$email->last_name) $message->to($email->alert_email)->subject($email->subject); foreach ($email->bcc_admin as $e) { $message->bcc($e); } //$message->to('*****@*****.**', 'Andrei Tsygankov')->subject('Alerts'); }); $mail_counter++; //$this->info($email->alert_id.' '.$record->type.' '.$email->last_name); if ($isDown) { CheckAlertEmail::where('alert_id', $email->alert_id)->update(array('last_sent' => gmdate("Y-m-d H:i:s"), 'times_sent' => $times_sent + 1)); } else { CheckAlertEmail::where('alert_id', $email->alert_id)->update(array('last_sent' => '0000-00-00 00:00:00', 'times_sent' => 0)); } } } // just send to admin /* if(!count($alert_emails)) { Mail::send('emails.cronalert', (array)$record, function($message) { $message->from('*****@*****.**', 'KeepUsUp'); $message->to('*****@*****.**', 'Admin') ->subject('Alerts') //->cc('*****@*****.**') ; }); $mail_counter++; } */ } $this->info('Successfully sent ' . $mail_counter . ' emails'); } else { if (isset($response_array->Result)) { $this->info('Failed with result=' . $response_array->Result); } else { $this->info('Failed with to fetch REST API data'); } } }
<?php // Events Breadcrumbs::register('admin.settings.index', function (\DaveJamesMiller\Breadcrumbs\Generator $breadcrumbs) { $breadcrumbs->parent('dashboard'); $breadcrumbs->push(Str::title(trans('settings::global.name')), route('admin.settings.index')); });
@foreach($main_links as $menu_title => $menu_item) <?php $menu_title = Str::title(str_replace('_', ' ', $menu_title)); ?> <?php //if this is > 1 means it is a group of items for a menu ?> <?php if (count($menu_item) > 1) { ?> <li class="dropdown"> <a class="dropdown-toggle" data-toggle="dropdown" href="{{ URL::base().'/'.ADM_URI.'/' }}"> {{ $menu_title }} <b class="caret"></b></a> {{ themes\render_admin_sub_menu_items($menu_item, 'class="dropdown-menu"') }} </li> <?php } else { ?> <?php $menu_url = isset($menu_item['0']['url']) ? $menu_item['0']['url'] : '#'; ?> <li class="{{ isset($menu_item['0']['li_class']) ? $menu_item['0']['li_class'] : '' }}"><a href="{{ URL::base().'/'.ADM_URI.'/'. $menu_url }}" class="{{ isset($menu_item['0']['class']) ? $menu_item['0']['class'] : '' }}">{{ $menu_title }}</a></li> <?php } ?> @endforeach
public function get_show($tag) { $paintings = Tag::where('name', '=', $tag)->first()->paintings()->paginate(Config::get('app.paginator_count')); return View::make('tags.show')->with('title', HtmlHelpers::name('tags') . ' - ' . Str::title($tag))->with('nav', 'work')->with('tag', $tag)->with('paintings', $paintings); }
public function updateEmail() { if (!Request::isMethod('post')) { return App::abort(404); } $arrPost = Input::all(); unset($arrPost['_token']); foreach ($arrPost as $key => $value) { $key = 'email_' . $key; $configure = Configure::firstOrNew(['ckey' => $key]); $configure->ckey = $key; $configure->cname = Str::title(str_replace('email_', ' ', $key)); $configure->cvalue = $value; $configure->save(); } return Redirect::to(URL . '/admin/email-templates')->with('flash_success', 'Email Configure has been saved.'); }
<?php // Line Break </br> HTML::macro('br', function ($count = 1) { $br = str_repeat("</br>", $count); return $br; }); // Table HTML::macro('table', function ($current_settings = array(), $fields = array()) { $table = '<div class="table-responsive"><table class="table table-bordered table-hover table-striped">'; $table .= '<tr>'; foreach ($fields as $field) { $table .= '<th>' . Str::title($field) . '</th>'; } $table .= '</tr>'; $table .= '<tr>'; if ($current_settings == null) { foreach ($fields as $value) { $table .= '<td>Value</td>'; } } else { foreach ($current_settings as $value) { $table .= '<td>' . $value . '</td>'; } } $table .= '</tr>'; $table .= '</table></div>'; return $table; }); // Delete Modal HTML::macro('deleteModal', function ($modalID, $resource, $resource_name, $resource_id) {
<?php // Blocks breadcrumbs Breadcrumbs::register('admin.blocks.index', function (\DaveJamesMiller\Breadcrumbs\Generator $breadcrumbs) { $breadcrumbs->parent('dashboard'); $breadcrumbs->push(Str::title(trans('blocks::global.name')), route('admin.blocks.index')); }); Breadcrumbs::register('admin.blocks.edit', function (\DaveJamesMiller\Breadcrumbs\Generator $breadcrumbs, \TypiCMS\Modules\Blocks\Models\Block $block) { $breadcrumbs->parent('admin.blocks.index'); $breadcrumbs->push($block->name, route('admin.blocks.edit', $block->id)); }); Breadcrumbs::register('admin.blocks.create', function (\DaveJamesMiller\Breadcrumbs\Generator $breadcrumbs) { $breadcrumbs->parent('admin.blocks.index'); $breadcrumbs->push(trans('blocks::global.New'), route('admin.blocks.create')); });
<?php // Menulinks Breadcrumbs::register('admin.menus.menulinks.index', function (\DaveJamesMiller\Breadcrumbs\Generator $breadcrumbs, \TypiCMS\Modules\Menus\Models\Menu $menu) { $breadcrumbs->parent('admin.menus.edit', $menu); $breadcrumbs->push(Str::title(trans('menulinks::global.name')), route('admin.menus.menulinks.index', $menu->id)); }); Breadcrumbs::register('admin.menus.menulinks.edit', function (\DaveJamesMiller\Breadcrumbs\Generator $breadcrumbs, \TypiCMS\Modules\Menus\Models\Menu $menu, \TypiCMS\Modules\Menulinks\Models\Menulink $menulink) { $breadcrumbs->parent('admin.menus.menulinks.index', $menu); $breadcrumbs->push($menulink->title, route('admin.menus.index')); }); Breadcrumbs::register('admin.menus.menulinks.create', function (\DaveJamesMiller\Breadcrumbs\Generator $breadcrumbs, \TypiCMS\Modules\Menus\Models\Menu $menu) { $breadcrumbs->parent('admin.menus.menulinks.index', $menu); $breadcrumbs->push(trans('menulinks::global.New'), route('admin.menus.index')); });
Route::match(['GET', 'POST'], '/lock', ['as' => 'lock', 'uses' => 'AdminController@lock']); Route::get('/logout', ['as' => 'logout', 'uses' => function () { Auth::admin()->logout(); Session::flush(); return Redirect::to('/admin/login'); }]); /* Dynamic route * * controller must be same as controller class without 'Controller' string. * action must be same as method, and should be slug string. * EX: 'pages/show-list' will call PagesController and showList method of PagesController * */ Route::match(['GET', 'POST'], '{controller}/{action?}/{args?}', function ($controller, $action = 'index', $args = '') { $controller = str_replace('-', ' ', strtolower(preg_replace('/[^A-Za-z0-9\\-]/', '', $controller))); $controller = str_replace(' ', '', Str::title($controller)); $controller = '\\' . $controller . 'Controller'; if (!class_exists($controller)) { return App::abort(404, "Controller '{$controller}' was not existed."); } $action = str_replace('-', ' ', preg_replace('/[^A-Za-z0-9\\-]/', '', $action)); $method = Str::camel($action); if (!method_exists($controller, $method)) { return App::abort(404, "Method '{$method}' was not existed."); } $params = explode("/", $args); /* * Check permission */ if (!Permission::checkPermission($controller, $method, $params)) { return App::abort(403, 'Need permission to access this page.');
<?php // Translations Breadcrumbs::register('admin.translations.index', function (\DaveJamesMiller\Breadcrumbs\Generator $breadcrumbs) { $breadcrumbs->parent('dashboard'); $breadcrumbs->push(Str::title(trans('translations::global.name')), route('admin.translations.index')); }); Breadcrumbs::register('admin.translations.edit', function (\DaveJamesMiller\Breadcrumbs\Generator $breadcrumbs, \TypiCMS\Modules\Translations\Models\Translation $translation) { $breadcrumbs->parent('admin.translations.index'); $breadcrumbs->push($translation->key, route('admin.translations.edit', $translation->id)); }); Breadcrumbs::register('admin.translations.create', function (\DaveJamesMiller\Breadcrumbs\Generator $breadcrumbs) { $breadcrumbs->parent('admin.translations.index'); $breadcrumbs->push(trans('translations::global.New'), route('admin.translations.create')); });
<?php // Groups Breadcrumbs::register('admin.groups.index', function (\DaveJamesMiller\Breadcrumbs\Generator $breadcrumbs) { $breadcrumbs->parent('dashboard'); $breadcrumbs->push(Str::title(trans('groups::global.name')), route('admin.groups.index')); }); Breadcrumbs::register('admin.groups.edit', function (\DaveJamesMiller\Breadcrumbs\Generator $breadcrumbs, $group_id) { $group = Sentry::findGroupById($group_id); $breadcrumbs->parent('admin.groups.index'); $breadcrumbs->push($group->name, route('admin.groups.edit', $group_id)); }); Breadcrumbs::register('admin.groups.create', function (\DaveJamesMiller\Breadcrumbs\Generator $breadcrumbs) { $breadcrumbs->parent('admin.groups.index'); $breadcrumbs->push(trans('groups::global.New'), route('admin.groups.create')); });
<?php // Files Breadcrumbs::register('admin.files.index', function (\DaveJamesMiller\Breadcrumbs\Generator $breadcrumbs) { $breadcrumbs->parent('dashboard'); $breadcrumbs->push(Str::title(trans('files::global.name')), route('admin.files.index')); }); // Files linked to modules $modulesWithFiles = array('pages', 'events', 'news', 'projects'); foreach ($modulesWithFiles as $module) { Breadcrumbs::register('admin.' . $module . '.files.index', function (\DaveJamesMiller\Breadcrumbs\Generator $breadcrumbs, \TypiCMS\Modules\Files\Models\File $model) use($module) { $breadcrumbs->parent('admin.' . $module . '.edit', $model); $breadcrumbs->push(Str::title(trans_choice('files::global.files', 2)), route('admin.' . $module . '.files.index', $model->id)); }); Breadcrumbs::register('admin.' . $module . '.files.edit', function (\DaveJamesMiller\Breadcrumbs\Generator $breadcrumbs, $model, \TypiCMS\Modules\Files\Models\File $file) use($module) { $breadcrumbs->parent('admin.' . $module . '.files.index', $model); $breadcrumbs->push($file->filename, route('admin.' . $module . '.index')); }); Breadcrumbs::register('admin.' . $module . '.files.create', function (\DaveJamesMiller\Breadcrumbs\Generator $breadcrumbs, $model) use($module) { $breadcrumbs->parent('admin.' . $module . '.files.index', $model); $breadcrumbs->push(trans('files::global.New'), route('admin.' . $module . '.index')); }); }
public function post_create() { $validation = Pages\Model\Page::validate(Input::all()); if ($validation->passes()) { $is_home_post = Input::get('is_home'); // If post comming from duplicate // we have parend_id and parent_slug $slug = Input::get('slug'); $parent_slug = Input::get('parent_slug'); if (isset($parent_slug) and !empty($parent_slug)) { $slug = $parent_slug . '/' . $slug; } $parent_id = Input::get('parent_id'); $parent_id = $parent_id != 0 ? $parent_id : 0; $restricted_to = Input::get('restricted_to'); if ($restricted_to == null) { $restricted_to = array('0' => '0'); } $restricted_to = implode(',', $restricted_to); $page = new Pages\Model\Page(); $page->parent_id = $parent_id; $page->title = Input::get('title'); $page->slug = $slug; $page->status = Input::get('status'); $page->meta_title = Input::get('meta_title'); $page->meta_keywords = Input::get('meta_keywords'); $page->meta_description = Input::get('meta_description'); $page->body = Input::get('body'); $page->restricted_to = $restricted_to; $page->is_home = (isset($is_home_post) and $is_home_post == 1) ? 1 : 0; $page->strict_uri = Input::get('strict_uri'); $page->save(); // the user want to create a navigation link? $navigation_id = Input::get('navigation_group_id'); if (is_numeric($navigation_id) and $navigation_id != 0) { // If the user want to create a link // for this page, we need to set this // page as live or it will break navigation $page->status = 'live'; $page->save(); $link = new Navigation\Model\Link(); // add a link for this page to the navigation $link->title = Str::title($page->title); $link->link_type = 'page'; $link->page_id = $page->id; $link->group_id = $navigation_id; $link->save(); } $this->data['message'] = Lang::line('pages::lang.Page was successfully created')->get(ADM_LANG); $this->data['message_type'] = 'success'; return Redirect::to(ADM_URI . '/pages')->with($this->data); } else { return Redirect::to(ADM_URI . '/pages/new')->with_errors($validation)->with_input(); } }
public function postEditar() { //Quitar espacios en nombres poner en mayuscula solo la primer letra $nombre = trim(Str::title(Input::get('nombres'))); $ap_pat = trim(Str::title(Input::get('apellido_paterno'))); $ap_mat = trim(Str::title(Input::get('apellido_materno'))); if (Input::has('fecha_ingreso')) { $ingreso = Input::get('fecha_ingreso'); } else { $ingreso = date("Y-m-d"); } $asesor = Asesor::find(Input::get('asesor_id')); $asesor->fecha_ingreso = $ingreso; $asesor->save(); $persona = Persona::find($asesor->persona_id); $persona->nombres = $nombre; $persona->apellido_paterno = $ap_pat; $persona->apellido_materno = $ap_mat; $persona->save(); if (Input::has('telefono') and Input::has('id_telefono')) { $telefono_asesor = TelefonoAsesor::where('asesor_id', '=', Input::get('asesor_id'))->where('tipo_telefono_id', '=', 2)->first(); $telefono_recup = Input::get('telefono'); if ($telefono_asesor) { if ($telefono_asesor != $telefono_recup) { $telefono_edit = TelefonoAsesor::find(Input::get('id_telefono')); $telefono_edit->telefono = Input::get('telefono'); $telefono_edit->save(); } } else { $telefono_asesor = new TelefonoAsesor(); } $telefono_asesor->telefono = Input::get('telefono'); $telefono_asesor->asesor_id = Input::get('asesor_id'); $telefono_asesor->tipo_telefono_id = 2; $telefono_asesor->save(); } if (Input::has('celular') and Input::has('id_telefono_c')) { $celular_asesor = TelefonoAsesor::where('asesor_id', '=', Input::get('asesor_id'))->where('tipo_telefono_id', '=', 1)->first(); $celular_recup = Input::get('celular'); if ($celular_asesor) { if ($celular_asesor != $celular_recup) { $celular_edit = TelefonoAsesor::find(Input::get('id_telefono_c')); $celular_edit->telefono = Input::get('celular'); $celular_edit->save(); } } else { $celular_asesor = new TelefonoAsesor(); } $celular_asesor->telefono = Input::get('celular'); $celular_asesor->asesor_id = Input::get('asesor_id'); $celular_asesor->tipo_telefono_id = 1; $celular_asesor->save(); } switch (Input::get('promotor_id')) { default: $existe_promo = Promotor::where('asesor_id', '=', Input::get('asesor_id'))->first(); //vendedor EXISTENTE cambio de promotoria Existente if ($existe_promo) { $promo = Promotor::find($existe_promo->id); $promo->promotor_id = Input::get('promotor_id'); $promo->save(); } else { //vendedor INDEPENDIENTE asignar NUEVA promotoria existente $promotoria = new Promotor(); $promotoria->promotor_id = Input::get('promotor_id'); $promotoria->asesor_id = $asesor->id; $promotoria->save(); } break; case "ind": $existe_promo = Promotor::where('asesor_id', '=', Input::get('asesor_id'))->first(); //vendedor sale de promotoria if ($existe_promo) { $promo = Promotor::find($existe_promo->id); $promo->delete(); } break; case "new": //vendedor promotor $promotoria = new Promotor(); $promotoria->promotor_id = $asesor->id; $promotoria->asesor_id = $asesor->id; $promotoria->save(); break; } return Redirect::back(); }
public function postNicho() { //validar formulario nicho $rules = array('recinto_nombre' => 'required', 'fila_n' => 'required', 'columna' => 'required', 'monto' => 'required|numeric', 'porcentaje_comision' => 'required|numeric', 'porcentaje_minimo_comisionable' => 'required|numeric'); $messages = array('required' => 'El campo :attribute es obligatorio', 'numeric' => 'Capture solo números'); $validator = Validator::make(Input::all(), $rules, $messages); if ($validator->fails()) { return Redirect::back()->withInput()->withErrors($validator)->with('registro', 'edit_tab1')->with('tab', 'tab1'); } $departamento = "5"; $product_name = Str::title(Input::get('recinto_nombre')) . " Fila " . Input::get('fila_n') . " Columna " . Input::get('columna'); $nombre_construccion = Input::get('construccion'); //que no haya nichos repetidos con el mismo nombre $repetido = Producto::where('nombre', '=', $product_name)->count(); if ($repetido > 0) { return Redirect::back()->withInput()->with('status', 'nicho_repetido'); } //pasa validacion nicho $producto = new Producto(); $producto->departamento_id = $departamento; //es un producto del departamento de ventas $producto->nombre = $product_name; $producto->porcentaje_comision = Input::get('porcentaje_comision'); $producto->porcentaje_minimo_comisionable = Input::get('porcentaje_minimo_comisionable'); $producto->save(); $precio = new Precio(); $precio->producto_id = $producto->id; $precio->monto = Input::get('monto') / 1.16; $precio->save(); $lote = new Lote(); $lote->producto_id = $producto->id; $lote->save(); $nicho = new Nicho(); $nicho->lote_id = $lote->id; $nicho->recinto_id = Input::get('recinto_id'); $nicho->fila = Input::get('fila_n'); $nicho->columna = Input::get('columna'); $nicho->save(); return Redirect::back()->with('status', 'nicho_created')->with('tab', 'tab1')->with('registro', 'edit_tab1'); }
public function getEstadisticosdia() { setlocale(LC_ALL, 'spanish'); $dia = strftime("%A"); /*********diario **********/ $monto_recibos_cobranza = Recibo::where(DB::raw('YEAR(fecha_limite)'), '=', date('Y'))->where(DB::raw('MONTH(fecha_limite)'), '=', date('m'))->where(DB::raw('DAY(fecha_limite)'), '=', date('d'))->where('cancelado', 0)->sum('monto'); $monto_recibos_pagados = Recibo::where(DB::raw('YEAR(fecha_limite)'), '=', date('Y'))->where(DB::raw('MONTH(fecha_limite)'), '=', date('m'))->where(DB::raw('DAY(fecha_limite)'), '=', date('d'))->where('cancelado', 0)->where('pagado', 1)->sum('monto'); $monto_recibos_pendientes_cobrar = $monto_recibos_cobranza - $monto_recibos_pagados; if ($monto_recibos_cobranza > 0) { $porcentaje = $monto_recibos_pagados * 100 / $monto_recibos_cobranza; } else { $porcentaje = 0; } return Response::json(array("esperado" => number_format($monto_recibos_cobranza, 2, ".", ","), "cobrado" => number_format($monto_recibos_pagados, 2, ".", ","), "pendiente" => number_format($monto_recibos_pendientes_cobrar, 2, ".", ","), "porcentaje" => number_format($porcentaje, 2), "nombre" => Str::title($dia))); }
<?php // Contacts Breadcrumbs::register('admin.contacts.index', function (\DaveJamesMiller\Breadcrumbs\Generator $breadcrumbs) { $breadcrumbs->parent('dashboard'); $breadcrumbs->push(Str::title(trans('contacts::global.name')), route('admin.contacts.index')); }); Breadcrumbs::register('admin.contacts.edit', function (\DaveJamesMiller\Breadcrumbs\Generator $breadcrumbs, \TypiCMS\Modules\Contacts\Models\Contact $contact) { $breadcrumbs->parent('admin.contacts.index'); $breadcrumbs->push($contact->first_name . ' ' . $contact->last_name, route('admin.contacts.edit', $contact->id)); }); Breadcrumbs::register('admin.contacts.create', function (\DaveJamesMiller\Breadcrumbs\Generator $breadcrumbs) { $breadcrumbs->parent('admin.contacts.index'); $breadcrumbs->push(trans('contacts::global.New'), route('admin.contacts.create')); });
public static function schema($action, $module_slug) { try { // Does the schema task file exists? $schema_path = path('bundle') . $module_slug . DS . 'tasks' . DS . 'schema' . EXT; if (\File::exists($schema_path)) { include_once $schema_path; // Does the class exists? $class = \Str::title($module_slug . '_Schema_Task'); if (class_exists($class)) { $schema_class = new $class(); // The action is callable? if (is_callable(array($schema_class, $action))) { $schema_class->{$action}(); return true; } else { static::$errors->add('installer', 'Failed to run data schema for module ' . $module_slug . '. Schema action [' . $action . '] not found.'); } } else { static::$errors->add('installer', 'Failed to run data schema for module ' . $module_slug . '. Schema class [' . $class . '] not found.'); } } // we dont have task schema to run return true; } catch (\Exception $e) { static::$errors->add('installer', $e->getMessage()); return false; } }