public function edit($id) { $deduction = Deduction::find($id); $classifications = Classification::where('category', '=', 'Deduction')->get(); $menu = 'employee'; return View::make('deductions.edit', compact('deduction', 'classifications', 'menu')); }
public function create() { $menu = 'finance'; $employees = Employee::where('location_id', '=', Auth::user()->location_id)->get(); $classifications = Classification::where('category', '=', 'Operational')->get(); return View::make('spendings.create', compact('employees', 'classifications', 'menu')); }
public function edit($id) { $income = Income::find($id); $classifications = Classification::where('category', '=', 'Income')->get(); $menu = 'employee'; return View::make('incomes.edit', compact('income', 'classifications', 'menu')); }
public function edit($id) { $resign = Resign::find($id); $classifications = Classification::where('category', '=', 'Resign')->get(); $menu = 'student'; return View::make('resigns.edit', compact('resign', 'classifications', 'menu')); }
public function edit($id) { $course = Course::find($id); $classifications = Classification::all(); $generations = Generation::all(); $programs = Program::all(); $majors = Major::all(); $menu = 'project'; return View::make('courses.edit', compact('course', 'classifications', 'programs', 'generations', 'majors', 'menu')); }
public function destroy($id) { $classification = Classification::with('spendables', 'registrations', 'resigns')->find($id); if ($classification->spendables->count() > 0 || $classification->registrations->count() > 0 || $classification->resigns->count() > 0) { Session::flash('message', 'Tidak Dapat menghapus Klasifikasi! Klasifikasi ini Pernah Digunakan!'); } else { Classification::destroy($id); Session::flash('message', 'Sukses Menghapus Klasifikasi'); } }
public function edit($id) { $registration = Registration::find($id); $locations = Location::all(); $employees = Employee::where('location_id', '=', 18)->get(); $classifications = Classification::where('category', '=', 'Registration')->get(); $menu = 'registration'; return View::make('registrations.edit', compact('registration', 'menu', 'locations', 'employees', 'classifications')); }
/** * Remove the specified resource from storage. * DELETE /projectclassification/{id} * * @param int $id * @return Response */ public function destroy($id) { $classification = Classification::find($id)->delete(); if (is_null($classification)) { $class = 'error'; $message = 'Record does not exist.'; } else { $class = 'success'; $message = 'Record successfully deleted.'; } return Redirect::route('project.classification.index')->with('class', $class)->with('message', $message); }
public function recapCirculationGeneration() { $registrations = Classification::where('category', '=', 'Registration')->get(); $resigns = Classification::where('category', '=', 'Resign')->get(); $generations = Generation::all(); $comes = array(); $leaves = array(); foreach ($registrations as $registration) { $statistics = array(); foreach ($generations as $generation) { $count = Registration::with(array('issue'))->join('issues', 'issues.registration_id', '=', 'registrations.id')->where('registrations.project_id', '=', Auth::user()->curr_project_id)->where('registrations.location_id', '=', Auth::user()->location_id)->where('registrations.classification_id', '=', $registration->id)->where('issues.generation_id', '=', $generation->id)->count(); $statistics[] = array('count' => $count); } $comes[] = array('name' => $registration->name, 'statistics' => $statistics); } foreach ($resigns as $resign) { $statistics = array(); foreach ($generations as $generation) { $count = Resign::with(array('issue'))->join('issues', 'issues.id', '=', 'resigns.issue_id')->where('resigns.project_id', '=', Auth::user()->curr_project_id)->where('resigns.location_id', '=', Auth::user()->location_id)->where('resigns.classification_id', '=', $resign->id)->where('issues.generation_id', '=', $generation->id)->count(); $statistics[] = array('count' => $count); } $leaves[] = array('name' => $resign->name, 'statistics' => $statistics); } $menu = 'report'; return View::make('reports.recapcirculationgeneration', compact('comes', 'leaves', 'generations', 'menu')); }
/** * Static initializer for User_Agent that loads capabilities from the cookie * into a static object via self::parse_capabilities. If a cookie is not * set, this returns false. * * @return bool */ public static function init() { /** * If initialized, return initialized value without reprocessing. */ if (self::$_init !== null) { return self::$_init; } /** * Define name of the cookie set by asets/js/core/server.js. */ self::$_name = 'classification'; /** * If cookie is set, extract contents and parse the JSON into a PHP * object, then setting initialized value to true. Otherwise, set it * false, as initialization has failed since no cookie is defined. */ self::$_cookie = Cookie::get(self::$_name); if (isset(self::$_cookie)) { $capabilities = self::$_cookie; self::$_capabilities = self::parse($capabilities); self::$_init = true; } else { self::$_init = false; } /** * Return whether initialization succeeded or failed. */ return self::$_init; }
<?php /** * @file import_swisslichens_basedatav2.php * @author Reto Schneider, 2012, github@reto-schneider.ch * * Import lichens to the new naturvielfalt DB. */ require_once dirname(__FILE__) . '/lib/bootstrap.php'; require_once $libdir . '/Classification.php'; require_once $configdir . '/databases.php'; global $config; $db = new Db($config['naturvielfalt_dev']['driver'], $config['naturvielfalt_dev']['name'], $config['naturvielfalt_dev']['user'], $config['naturvielfalt_dev']['password'], $config['naturvielfalt_dev']['host']); $classifier = new Classification($config['naturvielfalt_dev']['driver'], $config['naturvielfalt_dev']['name'], $config['naturvielfalt_dev']['user'], $config['naturvielfalt_dev']['password'], $config['naturvielfalt_dev']['host']); $importTable = 'import_swisslichens_basedata'; /** * Copy all SwissLichens into naturvielfalt DB * * Column | Type | Modifiers * ----------------+------+----------- * genus | text | not null * species | text | not null * scientific_name | text | not null */ $classification_data = array('genus' => array('columnname' => 'genus')); // store all level names in $classification_level_columns $classification_level_columns = array(); foreach ($classification_data as $classification_level_name => $data) { $classification_level_columns[] = $data['columnname']; } // extract all unique organism classifications
} $category = !empty($category_name) ? "<a href='pluginsid.php?id={$id}&category_id={$category_id}'>{$category_name}</a>" : "-"; $xml .= "<cell><![CDATA[" . $category . "]]></cell>"; // subcategory if ($subcategory_id = $plugin->get_subcategory_id()) { if ($subcategory_list = Subcategory::get_list($conn, "WHERE id = '{$subcategory_id}'")) { $subcategory_name = "<a href='pluginsid.php?id={$id}&category_id={$category_id}&subcategory_id={$subcategory_id}'>" . $subcategory_list[0]->get_name() . "</a>"; } } else { $subcategory_name = ''; } $subcategory = !empty($subcategory_name) ? $subcategory_name : "-"; $xml .= "<cell><![CDATA[" . $subcategory . "]]></cell>"; // translate class id if ($class_id = $plugin->get_class_id()) { if ($class_list = Classification::get_list($conn, "WHERE id = '{$class_id}'")) { $class_name = $class_list[0]->get_name(); } } $class = !empty($class_name) ? $class_name : "-"; $xml .= "<cell><![CDATA[" . $class . "]]></cell>"; $xml .= "<cell><![CDATA[" . $name . "]]></cell>"; $prio = $plugin->get_priority(); $txt = "<select id='priority" . $sid . "' onchange='change_pri_rel(\"" . $sid . "\")'>"; $txt .= "<option value='0'" . ($prio == 0 ? " SELECTED " : "") . ">0</option>"; $txt .= "<option value='1'" . ($prio == 1 ? " SELECTED " : "") . ">1</option>"; $txt .= "<option value='2'" . ($prio == 2 ? " SELECTED " : "") . ">2</option>"; $txt .= "<option value='3'" . ($prio == 3 ? " SELECTED " : "") . ">3</option>"; $txt .= "<option value='4'" . ($prio == 4 ? " SELECTED " : "") . ">4</option>"; $txt .= "<option value='5'" . ($prio == 5 ? " SELECTED " : "") . ">5</option>"; $txt .= "</select>";
* existing organisms are updated using the organism_update_* functions (using the drupal api) * * @see improt_evab_crsf_basedata_v2.php for the initial data import */ // do a full drupal bootstrap to get the db API define('DRUPAL_ROOT', getcwd() . '/../../webroot_drupal'); include_once DRUPAL_ROOT . '/includes/bootstrap.inc'; drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); // add the classification class require_once dirname(__FILE__) . '/lib/bootstrap.php'; require_once $libdir . '/Classification.php'; require_once $configdir . '/databases.php'; global $errors; // set here your local drupal database prefix $drupalprefix = 'naturvielfalt_'; $classifier = new Classification($config['naturvielfalt_dev']['driver'], $config['naturvielfalt_dev']['name'], $config['naturvielfalt_dev']['user'], $config['naturvielfalt_dev']['password'], $config['naturvielfalt_dev']['host']); // the array used in $plant and $db_plant indizes define('ORGANISM_CRSF_ID', 0); define('ORGANISM_FAMILY', 1); define('ORGANISM_GENUS', 2); define('ORGANISM_SCIENTIFIC_NAME', 3); define('ORGANISM_DE', 4); define('ORGANISM_FR', 5); define('ORGANISM_IT', 6); define('ORGANISM_DB_ID', 7); // organism_id for existing plants /* * the following array controls, which data will be updated and how. * array-structure: * array{ * INDEX_TO_COMPARE => UPDATE_FUNCTION
if (isset($_GET['webkit_libs'])) { $loadarr = array_merge(explode(' ', $_GET['webkit_libs']), $loadarr); } foreach ($loadarr as $load) { JS::load_from_key($load); } } /** * Load custom JS files (minified) based on user agent. */ if (isset($_GET['basic'])) { foreach (explode(' ', $_GET['basic']) as $file) { if (Path_Validator::is_safe($file, 'js') && ($contents = Path::get_contents($file))) { echo ' ' . JSMin::minify($contents); } } } if (Classification::is_standard() && isset($_GET['standard'])) { foreach (explode(' ', $_GET['standard']) as $file) { if (Path_Validator::is_safe($file, 'js') && ($contents = Path::get_contents($file))) { echo ' ' . JSMin::minify($contents); } } } if (Classification::is_full() && isset($_GET['full'])) { foreach (explode(' ', $_GET['full']) as $file) { if (Path_Validator::is_safe($file, 'js') && ($contents = Path::get_contents($file))) { echo ' ' . JSMin::minify($contents); } } }
} /** * Scripts that will be minified and included at the STANDARD level and above. */ if (Classification::is_standard() && (isset($_GET['standard']) || isset($_GET['touch']))) { $loadarr = isset($_GET['standard']) ? explode(' ', $_GET['standard']) : array(); // Support for deprecated TOUCH parameter. if (isset($_GET['touch'])) { $loadarr = array_merge(explode(' ', $_GET['touch']), $loadarr); } foreach ($loadarr as $file) { if (Path_Validator::is_safe($file, 'css') && ($contents = Path::get_contents($file))) { echo CSSMin::minify($contents); } } } /** * Scripts that will be minified and included at the FULL level only. */ if (Classification::is_full() && (isset($_GET['full']) || isset($_GET['webkit']))) { $loadarr = isset($_GET['full']) ? explode(' ', $_GET['full']) : array(); // Support for deprecated WEBKIT parameter. if (isset($_GET['webkit'])) { $loadarr = array_merge(explode(' ', $_GET['webkit']), $loadarr); } foreach ($loadarr as $file) { if (Path_Validator::is_safe($file, 'css') && ($contents = Path::get_contents($file))) { echo CSSMin::minify($contents); } } }
return $text ? 'true' : 'false'; } function text2text($text) { return $text ? $text : 'false'; } function js2bool2text($function) { return '<script type="text/javascript"> document.write(' . $function . '() ? "true" : "false"); </script>'; } function js2text($function) { return '<script type="text/javascript"> var t; if(t = ' . $function . '()) document.write(t); else document.write("false"); </script>'; } echo HTML_Decorator::html_start()->render(); echo Site_Decorator::head()->set_title('MWF About')->render(); echo HTML_Decorator::body_start()->render(); echo Site_Decorator::header()->set_title('MWF Device')->render(); echo Site_Decorator::content_full()->set_padded()->add_header('The Framework')->add_subheader('Server Info')->add_section(label('User Agent') . $_SERVER['HTTP_USER_AGENT'])->add_section(label('IP Address') . $_SERVER['REMOTE_ADDR'])->add_subheader('JS Classification')->add_section(label('mwf.classification.isMobile()') . js2bool2text('mwf.classification.isMobile'))->add_section(label('mwf.classification.isBasic()') . js2bool2text('mwf.classification.isBasic'))->add_section(label('mwf.classification.isStandard()') . js2bool2text('mwf.classification.isStandard'))->add_section(label('mwf.classification.isFull()') . js2bool2text('mwf.classification.isFull'))->add_section(label('mwf.classification.isOverride()') . js2bool2text('mwf.classification.isOverride'))->add_section(label('mwf.classification.isPreview()') . js2bool2text('mwf.classification.isPreview'))->add_subheader('PHP Classification')->add_section(label('Classification::is_mobile()') . bool2text(Classification::is_mobile()))->add_section(label('Classification::is_basic()') . bool2text(Classification::is_basic()))->add_section(label('Classification::is_standard()') . bool2text(Classification::is_standard()))->add_section(label('Classification::is_full()') . bool2text(Classification::is_full()))->add_section(label('Classification::is_override()') . bool2text(Classification::is_override()))->add_section(label('Classification::is_preview()') . bool2text(Classification::is_preview()))->add_subheader('JS User Agent')->add_section(label('mwf.userAgent.getOS()') . js2text('mwf.userAgent.getOS'))->add_section(label('mwf.userAgent.getOSVersion()') . js2text('mwf.userAgent.getOSVersion'))->add_section(label('mwf.userAgent.getBrowser()') . js2text('mwf.userAgent.getBrowser'))->add_section(label('mwf.userAgent.getBrowserEngine()') . js2text('mwf.userAgent.getBrowserEngine'))->add_section(label('mwf.userAgent.getBrowserEngineVersion()') . js2text('mwf.userAgent.getBrowserEngineVersion'))->add_subheader('PHP User Agent')->add_section(label('User_Agent::get_os()') . text2text(User_Agent::get_os()))->add_section(label('User_Agent::get_os_version()') . text2text(User_Agent::get_os_version()))->add_section(label('User_Agent::get_browser()') . text2text(User_Agent::get_browser()))->add_section(label('User_Agent::get_browser_engine()') . text2text(User_Agent::get_browser_engine()))->add_section(label('User_Agent::get_browser_engine_version()') . text2text(User_Agent::get_browser_engine_version()))->add_subheader('JS Screen')->add_section(label('mwf.screen.getHeight()') . js2text('mwf.screen.getHeight'))->add_section(label('mwf.screen.getWidth()') . js2text('mwf.screen.getWidth'))->add_section(label('mwf.screen.getPixelRatio()') . js2text('mwf.screen.getPixelRatio'))->add_subheader('PHP Screen')->add_section(label('Screen::get_height()') . text2text(Screen::get_height()))->add_section(label('Screen::get_width()') . text2text(Screen::get_width()))->add_section(label('Screen::get_pixel_ratio()') . text2text(Screen::get_pixel_ratio()))->render(); echo Site_Decorator::button_full()->set_padded()->add_option(Config::get('global', 'back_to_home_text'), Config::get('global', 'site_url'))->render(); echo Site_Decorator::default_footer()->render(); echo HTML_Decorator::body_end()->render(); echo HTML_Decorator::html_end()->render();
/** * Imports a Javascript file (live DOM write of a new script tag) for a * given $key based on device classification. If full, then $key may be * assets/js/full/{$key}{$ext} for any extension $ext in the array $_exts. * If standard, or if full and not in assets/js/full, this it may under * assets/js/standard/{$key}{$ext} for any extension $ext in $_exts. This * returns false if no matching file found. * * * @param string $key * @return bool */ public static function import_key($key) { /** * If full device, check each $_exts as assets/js/full/{$key}{$ext}. * If found, then use import_file() to write a script tag via a live * DOM write. */ if (Classification::is_full()) { foreach (self::$_exts as $ext) { if (self::import_file('full/' . $key . $ext)) { return true; } } } /** * If standard device, or if full device and not already returned, check * each $_exts as assets/js/full/{$key}{$ext}. If found, then use * import_file() to write a script tag via a live DOM write. */ if (Classification::is_standard()) { foreach (self::$_exts as $ext) { if (self::import_file('standard/' . $key . $ext)) { return true; } } } return false; }