Inheritance: extends ADMIN_Controller
Example #1
0
 /**
  * Process asset content
  *
  * @param   string $content
  * @param   Asset  $asset
  *
  * @return  string
  */
 public static function process($content, Asset $asset)
 {
     // Set Less
     $lc = new lessc();
     $lc->importDir = dirname($asset->source_file()) . DIRECTORY_SEPARATOR;
     return $lc->parse($content);
 }
Example #2
0
 public function run()
 {
     // create default user asset
     $asset = Asset::where('filename', '=', 'default.png')->first();
     if ($asset == NULL) {
         $asset = new Asset();
         $asset->filename = 'default.png';
         $asset->path = 'assets/content/users';
         $asset->save();
     }
     $admin = Role::where('name', '=', 'Admin')->first();
     // create default roles
     if ($admin == NULL) {
         $admin = new Role();
         $admin->name = 'Admin';
         $admin->save();
     }
     $adminUser = User::where('username', '=', 'admin')->first();
     if ($adminUser != NULL) {
         echo "Admin User Already Exsit";
     } else {
         $adminUser = new User();
         $adminUser->username = '******';
         $adminUser->email = '*****@*****.**';
         $adminUser->password = '******';
         $adminUser->password_confirmation = 'admin';
         $adminUser->confirmation_code = md5(uniqid(mt_rand(), true));
         if ($adminUser->save()) {
             $adminUser->attachRole($admin);
             echo "Admin User Created";
         }
     }
 }
 /**
  * @see Object\ClassDefinition\Data::getDataForResource
  * @param Asset $data
  * @param null|Model\Object\AbstractObject $object
  * @return integer|null
  */
 public function getDataForResource($data, $object = null)
 {
     if ($data instanceof PriceRule) {
         return $data->getId();
     }
     return null;
 }
Example #4
0
 public function setupDatabases()
 {
     $name = $this->call('migrate', array('--path' => 'app/database/migrations/setup/'));
     $name = $this->call('migrate');
     // create the roles
     $roles = ['Admin', 'Writer', 'Reader'];
     foreach ($roles as $r) {
         $role = Role::whereName($r)->first();
         if ($role == null) {
             $role = new Role();
             $role->name = $r;
             $role->display_name = $r;
             $role->save();
             $this->info("{$role->id} Creating Role:{$r}");
         }
     }
     foreach (User::all() as $u) {
         $this->info("{$u->id} : user: {$u->username}");
     }
     // add core assets
     $m = Asset::findFromTag('missing-user-image');
     if ($m == NULL) {
         $m = new Asset();
         $m->path = "assets/content/uploads";
         $m->saveLocalFile(public_path('assets/content/common/missing/profile-default.png'), 'profile-default.png');
         $m->tag = 'missing-user-image';
         $m->shared = 1;
         $m->type = Asset::ASSET_TYPE_IMAGE;
         $m->save();
     }
     $this->comment("****\tAll Databases for Halp have been setup :-) \t****");
     return;
 }
Example #5
0
 public function test_process()
 {
     $asset = new Asset(Assets::STYLESHEET, 'test-sass.css.sass');
     $sass = file_get_contents($asset->source_file());
     $css = file_get_contents($asset->destination_file());
     $converted = Asset_Engine_Sass::process($sass, $asset);
     $this->assertEquals($css, $converted);
 }
Example #6
0
 public function test_process()
 {
     $asset = new Asset(Assets::JAVASCRIPT, 'test-coffee.js.coffee');
     $coffee = file_get_contents($asset->source_file());
     $js = file_get_contents($asset->destination_file());
     $converted = Asset_Engine_Coffee::process($coffee, $asset);
     $this->assertEquals($js, $converted);
 }
Example #7
0
 /**
  * @param Asset $asset
  */
 public function addAsset(Asset $asset)
 {
     if ($asset->getAssetHandle()) {
         $this->add($asset->getAssetPointer());
     } else {
         // doesn't check anything. this is useful for layouts, etc... other handle-less assets.
         $this->assets[] = $asset;
     }
 }
 public function userpic()
 {
     $userpic_id = $this->author_userpic_asset_id;
     if (empty($userpic_id) || !is_numeric($userpic_id)) {
         return;
     }
     require_once 'class.mt_asset.php';
     $asset = new Asset();
     $asset->Load("asset_id = {$userpic_id}");
     return $asset;
 }
Example #9
0
 /**
  * Process asset content
  *
  * @param   string $content
  * @param   Asset  $asset
  *
  * @return  string
  */
 public static function process($content, Asset $asset)
 {
     // Set error reporting
     $old = error_reporting(E_ALL & ~(E_NOTICE | E_DEPRECATED | E_STRICT));
     // Set content
     CoffeeScript\Init::load();
     $options = array('filename' => Debug::path($asset->source_file()), 'header' => FALSE);
     $content = CoffeeScript\Compiler::compile($content, $options);
     // Set error reporting
     error_reporting($old);
     return $content;
 }
 public function asset()
 {
     $col_name = "objectasset_asset_id";
     $asset = null;
     if (isset($this->{$col_name}) && is_numeric($this->{$col_name})) {
         $asset_id = $this->{$col_name};
         require_once 'class.mt_asset.php';
         $asset = new Asset();
         $asset->Load("asset_id = {$asset_id}");
     }
     return $asset;
 }
Example #11
0
 /**
  * Process asset content
  *
  * @param   string  $content
  * @param   Asset   $asset
  * @return  string
  */
 public static function process($content, Asset $asset)
 {
     // Set error reporting
     $old = error_reporting(E_ALL & ~(E_NOTICE | E_DEPRECATED | E_STRICT));
     // Include the engine
     include_once Kohana::find_file('vendor/coffeescript/CoffeeScript', 'Init');
     // Set content
     CoffeeScript\Init::load();
     $options = array('filename' => Debug::path($asset->source_file()), 'header' => TRUE);
     $content = CoffeeScript\Compiler::compile($content, $options);
     // Set error reporting
     error_reporting($old);
     return $content;
 }
 /**
  * フリーマーケット詳細表示画面
  *
  * @access public
  * @param mixed $fleamarket_id フリーマーケットID
  * @return void
  * @author ida
  */
 public function get_detail($fleamarket_id)
 {
     Asset::css('jquery-ui.min.css', array(), 'add_css');
     Asset::js('jquery-ui.min.js', array(), 'add_js');
     if (!$fleamarket_id) {
         return $this->forward('errors/notfound', 404);
     }
     $fleamarket = \Model_Fleamarket::findDetail($fleamarket_id);
     if (!$fleamarket) {
         return $this->forward('errors/notfound', 404);
     }
     $this->setHtmlReplace(array('AREA' => $this->getArea($fleamarket['prefecture_id']), 'AREA_NAME' => $this->getAreaName($fleamarket['prefecture_id']), 'FLEAMARKET_NAME' => $fleamarket['name'], 'LOCATION_ID' => $fleamarket['location_id'], 'LOCATION_NAME' => $fleamarket['location_name']));
     $fleamarket_abouts = \Model_Fleamarket_About::findByFleamarketId($fleamarket_id);
     $fleamarket_images = \Model_Fleamarket_Image::findByFleamarketId($fleamarket_id);
     $entry_styles = \Model_Fleamarket_Entry_Style::findByFleamarketId($fleamarket_id);
     $entries = \Model_Entry::getTotalEntryByFleamarketId($fleamarket_id);
     $fleamarket['entries'] = $entries;
     $view_model = \ViewModel::forge('search/detail');
     $view_model->set('fleamarket', $fleamarket, false);
     $view_model->set('fleamarket_images', $fleamarket_images, false);
     $view_model->set('fleamarket_abouts', $fleamarket_abouts, false);
     $view_model->set('fleamarket_entry_styles', $entry_styles, false);
     $view_model->set('entries', $entries, false);
     $view_model->set('prefectures', \Config::get('master.prefectures'), false);
     $view_model->set('user', $this->login_user, false);
     $this->template->content = $view_model;
 }
Example #13
0
 public function __construct()
 {
     /* Set the Language Based on Agent Browser */
     $languages = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
     $lang = substr($languages[0], 0, 2);
     App::setLocale($lang);
     /* Load Assets */
     Asset::add('bootstraptheme', 'assets/css/bootstrap-spacelab.css');
     Asset::add('bootstrapresponsive', 'assets/css/bootstrap-responsive.css');
     Asset::add('charisma', 'assets/css/charisma-app.css');
     Asset::add('uniform', 'assets/css/uniform.default.css');
     Asset::add('elfinder', 'assets/css/elfinder.min.css');
     Asset::add('opaicons', 'assets/css/opa-icons.css');
     Asset::add('famfam', 'assets/css/famfam.css');
     Asset::add('jqueryloadermin', 'assets/css/jquery.loader-min.css');
     Asset::add('reportula', 'assets/css/reportula.css');
     Asset::add('jquery', 'assets/js/jquery-2.0.3.min.js');
     Asset::add('datatables', 'assets/js/jquery.dataTables.min.js', 'jquery');
     Asset::add('jqueryloader', 'assets/js/jquery.loader-min.js', 'jquery');
     Asset::add('main', 'assets/js/main.js', 'TableTools');
     Asset::add('modal', 'assets/js/bootstrap-modal.js', 'jquery');
     /* Get Monolog instance from Laravel */
     $monolog = Log::getMonolog();
     /* Add the FirePHP handler */
     $monolog->pushHandler(new \Monolog\Handler\FirePHPHandler());
     /* Resolve Database Names Myslq and Postgres */
     if (Config::get('database.default') == 'mysql') {
         $this->tables = array('job' => 'Job', 'client' => 'Client', 'files' => 'Files', 'media' => 'Media', 'pool' => 'Pool', 'path' => 'Path', 'filename' => 'Filename', 'file' => 'File', 'jobfiles' => 'JobFiles', 'jobmedia' => 'JobMedia');
     } else {
         $this->tables = array('job' => 'job', 'client' => 'client', 'files' => 'files', 'media' => 'media', 'pool' => 'pool', 'path' => 'path', 'filename' => 'filename', 'file' => 'file', 'jobfiles' => 'jobfiles', 'jobmedia' => 'jobmedia');
     }
 }
Example #14
0
 public function __construct()
 {
     parent::__construct();
     Config::set('auth.driver', 'adminauth');
     Asset::add('bootstrap', 'bundles/adminify/css/bootstrap.min.css');
     Asset::add('style', 'bundles/adminify/css/style.css');
 }
Example #15
0
 /**
  * @todo Document this please.
  */
 public function __construct()
 {
     parent::__construct();
     // Not logged in or not an admin and don't have permission to see files
     if (!$this->current_user or $this->current_user->group !== 'admin' and (!isset($this->permissions['files']) or !isset($this->permissions['files']['wysiwyg']))) {
         $this->load->language('files/files');
         show_error(lang('files:no_permissions'));
     }
     ci()->admin_theme = $this->theme_m->get_admin();
     // Using a bad slug? Weak
     if (empty($this->admin_theme->slug)) {
         show_error('This site has been set to use an admin theme that does not exist.');
     }
     // Make a constant as this is used in a lot of places
     defined('ADMIN_THEME') or define('ADMIN_THEME', $this->admin_theme->slug);
     // Set the location of assets
     Asset::add_path('module', APPPATH . 'modules/wysiwyg/');
     Asset::add_path('theme', $this->admin_theme->web_path . '/');
     Asset::set_path('theme');
     $this->load->library('files/files');
     $this->lang->load('files/files');
     $this->lang->load('wysiwyg');
     $this->lang->load('buttons');
     $this->template->set_theme(ADMIN_THEME)->set_layout('wysiwyg', 'admin')->enable_parser(false)->append_css('module::wysiwyg.css')->append_css('jquery/ui-lightness/jquery-ui.css')->append_js('jquery/jquery.js')->append_js('jquery/jquery-ui.min.js')->append_js('plugins.js')->append_js('module::wysiwyg.js');
 }
 /**
  * 予約履歴一覧
  *
  * @access public
  * @param
  * @return void
  * @author kobayashi
  * @author ida
  */
 public function action_list()
 {
     Asset::css('jquery-ui.min.css', array(), 'add_css');
     Asset::js('jquery-ui.min.js', array(), 'add_js');
     $conditions = $this->getCondition();
     $condition_list = \Model_Entry::createAdminSearchCondition($conditions);
     $total_count = \Model_Entry::getCountByAdminSearch($condition_list);
     // ページネーション設定
     $pagination = \Pagination::forge('entry_pagination', $this->getPaginationConfig($total_count));
     $entry_list = \Model_Entry::findAdminBySearch($condition_list, $pagination->current_page, $this->result_per_page);
     $view_model = \ViewModel::forge('admin/entry/list');
     if (\Input::param('fleamarket_id')) {
         $fleamarket = \Model_Fleamarket::find(\Input::param('fleamarket_id'));
         $view_model->set('fleamarket', $fleamarket, false);
     }
     if (\Input::param('user_id')) {
         $user = \Model_User::find(Input::param('user_id'));
         $view_model->set('user', $user, false);
     }
     $view_model->set('entry_list', $entry_list, false);
     $view_model->set('pagination', $pagination, false);
     $view_model->set('conditions', $conditions, false);
     $view_model->set('total_count', $total_count);
     $this->template->content = $view_model;
 }
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $expiring_assets = Asset::getExpiringWarrantee(60);
     $data['count'] = count($expiring_assets);
     $data['email_content'] = '';
     foreach ($expiring_assets as $asset) {
         $now = date("Y-m-d");
         $expires = $asset->warrantee_expires();
         $difference = round(abs(strtotime($expires) - strtotime($now)) / 86400);
         if ($difference > 30) {
             $data['email_content'] .= '<tr style="background-color: #fcffa3;">';
         } else {
             $data['email_content'] .= '<tr style="background-color:#d9534f;">';
         }
         $data['email_content'] .= '<td><a href="' . Config::get('app.url') . '/hardware/' . $asset->id . '/view">';
         $data['email_content'] .= $asset->name . '</a></td><td>' . $asset->asset_tag . '</td>';
         $data['email_content'] .= '<td>' . $asset->warrantee_expires() . '</td>';
         $data['email_content'] .= '<td>' . $difference . ' days</td>';
         $data['email_content'] .= '</tr>';
     }
     if (Setting::getSettings()->alert_email != '' && Setting::getSettings()->alerts_enabled == 1) {
         if (count($expiring_assets) > 0) {
             Mail::send('emails.expiring-report', $data, function ($m) {
                 $m->to(Setting::getSettings()->alert_email, Setting::getSettings()->site_name);
                 $m->subject('Expiring Assets Report');
             });
         }
     } else {
         if (Setting::getSettings()->alert_email == '') {
             echo "Could not send email. No alert email configured in settings. \n";
         } elseif (Setting::getSettings()->alerts_enabled != 1) {
             echo "Alerts are disabled in the settings. No mail will be sent. \n";
         }
     }
 }
Example #18
0
 public function actionIndex()
 {
     $content = '';
     $name = '';
     $path = [];
     if (isset($_GET['active'])) {
         $path = explode(".", $_GET['active']);
         if (count($path) < 2) {
             $ref = new ReflectionClass($_GET['active']);
             $filename = $ref->getFileName();
             if (strpos($filename, Yii::getPathOfAlias('app')) === 0) {
                 $this->redirect(['/dev/genModel/index', 'active' => 'app.' . $_GET['active']]);
             } else {
                 if (strpos($filename, Yii::getPathOfAlias('application')) === 0) {
                     $this->redirect(['/dev/genModel/index', 'active' => 'plansys.' . $_GET['active']]);
                 }
             }
             throw new CHttpException(404);
             return false;
         }
         $module = array_shift($path);
         $name = $path[count($path) - 1];
         $path = implode(".", $path);
         $filePath = Yii::getPathOfAlias(($module == 'plansys' ? 'application' : 'app') . ".models." . $path) . ".php";
         $content = file_get_contents($filePath);
     }
     Asset::registerJS('application.static.js.lib.ace');
     $this->renderForm('DevGenModelIndex', ['content' => $content, 'name' => $name]);
 }
Example #19
0
 public function view()
 {
     // Group's inputs.
     $name_group_inputs = [View::forge('form/group/input', ['label_coltype' => 'col-xs-2', 'input_coltype' => 'col-xs-4', 'input' => Form::input('name', $this->requested_aircraft->name, ['class' => 'form-control', 'type' => 'text']), 'label' => 'A/C Name'], false)];
     $general_group_1_inputs = [View::forge('form/group/input', ['label_coltype' => 'col-xs-2', 'input_coltype' => 'col-xs-4', 'input' => Form::input('basic_empty_weight', $this->requested_aircraft->basic_empty_weight, ['class' => 'form-control', 'type' => 'number']) . "kg", 'label' => 'Basic Empty Weight'], false), View::forge('form/group/input', ['label_coltype' => 'col-xs-2', 'input_coltype' => 'col-xs-4', 'input' => Form::input('cg_position', $this->requested_aircraft->cg_position, ['class' => 'form-control', 'type' => 'number']) . "aft of datum", 'label' => 'C of G Position'], false)];
     $description_group_inputs = [View::forge('form/group/input', ['label_coltype' => 'col-xs-12', 'input_coltype' => 'col-xs-12', 'input' => Form::textarea('description', $this->requested_aircraft->description, ['class' => 'form-control']), 'label' => 'Description', 'label_left' => true], false)];
     $weight_limits_group_1_inputs = [View::forge('form/group/input', ['label_coltype' => 'col-xs-2', 'input_coltype' => 'col-xs-4', 'input' => Form::input('max_ramp_weight', $this->requested_aircraft->max_ramp_weight, ['class' => 'form-control', 'type' => 'text']), 'label' => 'Max Ramp Weight'], false), View::forge('form/group/input', ['label_coltype' => 'col-xs-2', 'input_coltype' => 'col-xs-4', 'input' => Form::input('mctow', $this->requested_aircraft->mctow, ['class' => 'form-control', 'type' => 'text']), 'label' => 'MCTOW'], false)];
     $weight_limits_group_2_inputs = [View::forge('form/group/input', ['label_coltype' => 'col-xs-2', 'input_coltype' => 'col-xs-4', 'input' => Form::input('mlw', $this->requested_aircraft->mlw, ['class' => 'form-control', 'type' => 'text']), 'label' => 'MLW'], false), View::forge('form/group/input', ['label_coltype' => 'col-xs-2', 'input_coltype' => 'col-xs-4', 'input' => Form::input('mzfw', $this->requested_aircraft->mzfw, ['class' => 'form-control', 'type' => 'text']), 'label' => 'MZFW'], false)];
     $arms_table_template = View::forge('widgets/tablewithactions/template', ['duplicate_action' => false, 'cells' => [View::forge('widgets/tablewithactions/row/cell', ['cell_content' => Form::input('_name', '', ['class' => 'form-control'])], false), View::forge('widgets/tablewithactions/row/cell', ['cell_content' => Form::input('_position', '', ['class' => 'form-control'])], false), View::forge('widgets/tablewithactions/row/cell', ['cell_content' => Form::input('_value', '', ['class' => 'form-control']) . Form::hidden('_type', 'arm')], false)]]);
     $arms_table = View::forge('widgets/tablewithactions', ['template_row' => $arms_table_template, 'name' => '_arms', 'coltype' => 'col-xs-12 col-md-6', 'headings' => ['<th>Label</th>', '<th>Arm (aft of datum)</th>', '<th>Max Weight</th>'], 'rows' => $this->arms_table_rows], false);
     $cglimits_table_template = View::forge('widgets/tablewithactions/template', ['duplicate_action' => false, 'cells' => [View::forge('widgets/tablewithactions/row/cell', ['cell_content' => Form::input('_position', '', ['class' => 'form-control'])], false), View::forge('widgets/tablewithactions/row/cell', ['cell_content' => Form::input('_value', '', ['class' => 'form-control']) . Form::hidden('_type', 'maxweight') . Form::hidden('_name', 'limit')], false)]]);
     $cglimits_table = View::forge('widgets/tablewithactions', ['template_row' => $cglimits_table_template, 'name' => '_arms', 'coltype' => 'col-xs-6', 'headings' => ['<th>Arm (aft of datum)</th>', '<th>Weight Limit</th>'], 'rows' => $this->cglimits_table_rows], false);
     $button_group_1_inputs = [Asset::js('tablewithactions.js', false), View::forge('form/button', ['coltype' => 'col-xs-offset-5 col-xs-2', 'link' => 'submit/aircraft/' . $this->id, 'response_target' => './aircraft_form', 'class' => 'form-control btn-success', 'label' => 'Save Changes'], false)];
     // Headings
     $general_heading = View::forge('form/heading', ['text' => 'General', 'size' => 4], false);
     $weight_limits_heading = View::forge('form/heading', ['text' => 'Weight Limits', 'size' => 4], false);
     $arms_heading = View::forge('form/heading', ['text' => 'Arms', 'size' => 4], false);
     $cg_limits_heading = View::forge('form/heading', ['text' => 'C of G Limits', 'size' => 4], false);
     // Groups
     $name_group = View::forge('form/group', ['inputs' => $name_group_inputs], false);
     $general_group_1 = View::forge('form/group', ['inputs' => $general_group_1_inputs], false);
     $description_group = View::forge('form/group', ['inputs' => $description_group_inputs], false);
     $weight_limits_group_1 = View::forge('form/group', ['inputs' => $weight_limits_group_1_inputs]);
     $weight_limits_group_2 = View::forge('form/group', ['inputs' => $weight_limits_group_2_inputs]);
     $buttons_group = View::forge('form/group', ['inputs' => $button_group_1_inputs], false);
     $cg_limits_group = View::forge('form/group', ['inputs' => ['<div class="col-xs-6">' . $cglimits_table . '</div>' . '<div class="col-xs-6">' . 'Graph here' . '</div>']], false);
     $weightandbalance_section_data = ['heading' => 'Weight and Balance Data', 'unique_id' => Str::random('uuid'), 'groups' => [$general_heading, $name_group, $general_group_1, $description_group, $weight_limits_heading, $weight_limits_group_1, $weight_limits_group_2, $arms_heading, $arms_table, $cg_limits_heading, $cg_limits_group, $buttons_group]];
     $weightandbalance_section = View::forge('form/section', $weightandbalance_section_data, false);
     $this->aircraft_form = $weightandbalance_section;
 }
Example #20
0
 /**
  * Loads a list of entries for the specicifies parameters, returns an array of Search_Backend_Data
  *
  * @return array
  */
 public function load()
 {
     $entries = array();
     $data = $this->db->fetchAll("SELECT * FROM search_backend_data" . $this->getCondition() . $this->getGroupBy() . $this->getOrder() . $this->getOffsetLimit(), $this->model->getConditionVariables());
     foreach ($data as $entryData) {
         if ($entryData['maintype'] == 'document') {
             $element = Document::getById($entryData['id']);
         } else {
             if ($entryData['maintype'] == 'asset') {
                 $element = Asset::getById($entryData['id']);
             } else {
                 if ($entryData['maintype'] == 'object') {
                     $element = Object_Abstract::getById($entryData['id']);
                 } else {
                     Logger::err("unknown maintype ");
                 }
             }
         }
         if ($element) {
             $entry = new Search_Backend_Data();
             $entry->setId(new Search_Backend_Data_Id($element));
             $entry->setFullPath($entryData['fullpath']);
             $entry->setType($entryData['type']);
             $entry->setSubtype($entryData['subtype']);
             $entry->setUserOwner($entryData['userowner']);
             $entry->setUserModification($entryData['usermodification']);
             $entry->setCreationDate($entryData['creationdate']);
             $entry->setModificationDate($entryData['modificationdate']);
             $entry->setPublished($entryData['published'] === 0 ? false : true);
             $entries[] = $entry;
         }
     }
     $this->model->setEntries($entries);
     return $entries;
 }
Example #21
0
 public function _index($id = 0, $fileType = 'i')
 {
     // if (!$this->input->is_ajax_request()) {
     // 	die('Ajax requests only...');
     // }
     //$this->template->set_layout(FALSE);
     $data = new stdClass();
     $data->showSizeSlider = $showSizeSlider;
     $data->showAlignButtons = $showAlignButtons;
     $data->fileType = $fileType;
     $data->folders = $this->file_folders_m->get_folders();
     $data->subfolders = array();
     $data->current_folder = $id && isset($data->folders[$id]) ? $data->folders[$id] : ($data->folders ? current($data->folders) : array());
     // Select the images for the current folder. In the future the selection of the type could become dynamic.
     // For future reference: a => audio, v => video, i => image, d => document, o => other.
     if ($data->current_folder) {
         $data->current_folder->items = $this->file_m->order_by('date_added', 'DESC')->where('type', $fileType)->get_many_by('folder_id', $data->current_folder->id);
         $subfolders = $this->file_folders_m->folder_tree($data->current_folder->id);
         foreach ($subfolders as $subfolder) {
             $data->subfolders[$subfolder->id] = repeater('&raquo; ', $subfolder->depth) . $subfolder->name;
         }
         // Set a default label
         $data->subfolders = $data->subfolders ? array($data->current_folder->id => lang('files.dropdown_root')) + $data->subfolders : array($data->current_folder->id => lang('files.dropdown_no_subfolders'));
     }
     // Array for select
     $data->folders_tree = array();
     foreach ($data->folders as $folder) {
         $data->folders_tree[$folder->id] = repeater('&raquo; ', $folder->depth) . $folder->name;
     }
     Asset::add_path('imagepicker', IMAGEPICKER_PATH . 'imagepicker/');
     $this->template->set_layout('modal')->append_js('imagepicker::imagepicker.js')->append_css('imagepicker::imagepicker.css')->build('files/admin/index', $data);
 }
 /**
  * Initialize bootstrap
  */
 public static function init()
 {
     $autoload = \Config::get('bootstrap.assets.autoload', false);
     if (!$autoload) {
         return;
     }
     $path = \Config::get('bootstrap.assets.path', '');
     $use_min = \Config::get('bootstrap.assets.use_min', true);
     $css_file = $path . 'bootstrap';
     $js_file = $path . 'bootstrap';
     if ($use_min) {
         $css_file .= '.min';
         $js_file .= '.min';
     }
     $css_file .= '.css';
     $js_file .= '.js';
     // See if Casset package is used.
     if (\Package::loaded('casset')) {
         \Casset::css($css_file, !$use_min);
         \Casset::js($js_file, !$use_min);
     } else {
         \Asset::css($css_file);
         \Asset::js($js_file);
     }
 }
Example #23
0
 public function restore()
 {
     $raw = file_get_contents($this->getStoreageFile());
     $element = Pimcore_Tool_Serialize::unserialize($raw);
     // check for element with the same name
     if ($element instanceof Document) {
         $indentElement = Document::getByPath($element->getFullpath());
         if ($indentElement) {
             $element->setKey($element->getKey() . "_restore");
         }
     } else {
         if ($element instanceof Asset) {
             $indentElement = Asset::getByPath($element->getFullpath());
             if ($indentElement) {
                 $element->setFilename($element->getFilename() . "_restore");
             }
         } else {
             if ($element instanceof Object_Abstract) {
                 $indentElement = Object_Abstract::getByPath($element->getFullpath());
                 if ($indentElement) {
                     $element->setKey($element->getKey() . "_restore");
                 }
             }
         }
     }
     $this->restoreChilds($element);
     $this->delete();
 }
 public function boot()
 {
     $config = $this->app['config'];
     $autoMinify = $config->get('assets.auto_minify');
     if ($autoMinify !== true && $autoMinify !== false) {
         $autoMinify = $config->get('app.debug', false);
     }
     Asset::$autoMinifyDefault = $autoMinify;
     foreach ($config->get('assets.compilers', []) as $extensions => $class) {
         $options = [];
         if (is_array($class)) {
             $options = array_get($class, 'options', []);
             $class = $class['class'];
         }
         $compiler = new $class($autoMinify, $options);
         foreach (explode(',', $extensions) as $extension) {
             Asset::registerCompiler($extension, $compiler);
         }
     }
     if ($this->app->resolved('router') || $this->app->bound('router')) {
         $router = $this->app['router'];
         $router->get('assets/img/{a?}/{b?}/{c?}/{d?}/{e?}', '\\Assets\\Http\\Controller@img');
         $router->get('assets/font/{a?}/{b?}/{c?}/{d?}/{e?}', '\\Assets\\Http\\Controller@font');
         $router->get('assets/fonts/{a?}/{b?}/{c?}/{d?}/{e?}', '\\Assets\\Http\\Controller@font');
         $router->get('assets/css/{a?}/{b?}/{c?}/{d?}/{e?}', '\\Assets\\Http\\Controller@css');
         $router->get('assets/{type}/{a?}/{b?}/{c?}/{d?}/{e?}', '\\Assets\\Http\\Controller@compile');
     }
     $this->commands(Console\PublishCommand::class, Console\UnpublishCommand::class, Console\InstallToolchainCommand::class);
     if (class_exists('\\Collective\\Html\\HtmlBuilder')) {
         \Collective\Html\HtmlBuilder::macro('assetPath', function ($path) {
             return Asset::publishedPath($path);
         });
     }
     $this->publishes([$this->configPath => config_path('assets.php')]);
 }
Example #25
0
 public static function run($debug = false, $mailOut = true)
 {
     try {
         self::$_debug = $debug;
         if ($debug) {
             echo '<pre>';
         }
         $objPHPExcel = self::_getOutput();
         if (!$objPHPExcel instanceof PHPExcel) {
             throw new Exception('System Error: can NOT generate CSV without PHPExcel object!');
         }
         // Set document properties
         $filePath = self::$_rootDir . '/' . md5(new UDate()) . '.csv';
         $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'CSV')->setDelimiter(',')->setEnclosure('"')->setLineEnding("\r\n")->setSheetIndex(0);
         ob_start();
         $objWriter->save('php://output');
         $excelOutput = ob_get_clean();
         $class = get_called_class();
         $asset = Asset::registerAsset($class::_getAttachedFileName(), $excelOutput, Asset::TYPE_TMP);
         if ($mailOut === true) {
             self::_mailOut($asset);
         }
         return $asset;
     } catch (Exception $ex) {
         echo $ex->getMessage();
         die('ERROR!');
     }
 }
Example #26
0
 /**
  * Compile
  *
  * Usage:
  * {{ compass:compile file="" output="" }}
  *
  * @param	array
  * @return	array
  */
 function compile()
 {
     $this->load->library('compass');
     $this->load->library('asset');
     $file = $this->attribute('file', 'style.scss');
     $attributes = $this->attributes();
     $module = $this->attribute('module', '_theme_');
     $output = $this->attribute('output', 'style.css');
     $base = $this->attribute('base', 'css');
     foreach (array('file', 'module', 'base', 'output') as $key) {
         if (isset($attributes[$key])) {
             unset($attributes[$key]);
         } else {
             if ($key === 'file') {
                 return '';
             }
         }
     }
     try {
         $viewsPath = rtrim($this->load->get_var('template_views'), '/');
         $themePath = preg_replace('#(\\/views(\\/web|\\/mobile)?)$#', '', $viewsPath) . '/';
         $compass = new Compass();
         $compass->init(Asset::get_filepath_css($file, false), Asset::get_filepath_css($output, false));
         return link_tag(Asset::get_filepath_css($output, true), 'stylesheet');
     } catch (exception $ex) {
         exit('Compass fatal error:<br />' . $file . ',' . $module . ',' . $base . '<br />' . $ex->getMessage());
     }
 }
 function __construct($file_path)
 {
     # create and store data required for this asset
     parent::__construct($file_path);
     # create and store additional data required for this asset
     $this->set_extended_data($file_path);
 }
Example #28
0
 public function run()
 {
     // Initialize empty array
     $asset = array();
     $date = new DateTime();
     // Pending (status_id is null, assigned_to = 0)
     $asset[] = array('name' => 'Shanen MBP', 'asset_tag' => 'NNY2878796', 'model_id' => 1, 'serial' => 'WS90585666669', 'purchase_date' => '2013-10-02', 'purchase_cost' => '2435.99', 'order_number' => '987698576946', 'created_at' => $date->modify('-10 day'), 'updated_at' => $date->modify('-3 day'), 'user_id' => 1, 'assigned_to' => 0, 'physical' => 1, 'archived' => 0, 'status_id' => NULL, 'notes' => '', 'deleted_at' => NULL, 'archived' => '0', 'warranty_months' => NULL, 'depreciate' => '0');
     $asset[] = array('name' => 'Michael MBP', 'asset_tag' => 'NNY28633396', 'model_id' => 1, 'serial' => 'WS905823226669', 'purchase_date' => '2013-10-02', 'purchase_cost' => '2435.99', 'order_number' => '987698576946', 'created_at' => $date->modify('-10 day'), 'updated_at' => $date->modify('-3 day'), 'user_id' => 1, 'assigned_to' => 0, 'physical' => 1, 'archived' => 0, 'status_id' => NULL, 'notes' => '', 'deleted_at' => NULL, 'archived' => '0', 'warranty_months' => NULL, 'depreciate' => '0');
     // RTD (status_id =0, assigned_to = 0)
     $asset[] = array('name' => 'Alison MBP', 'asset_tag' => 'NNY287958796', 'model_id' => 1, 'serial' => 'WS905869046069', 'purchase_date' => '2013-10-02', 'purchase_cost' => '2435.99', 'order_number' => '987698576946', 'created_at' => $date->modify('-10 day'), 'updated_at' => $date->modify('-3 day'), 'user_id' => 1, 'assigned_to' => 0, 'physical' => 1, 'archived' => 0, 'status_id' => 0, 'notes' => '', 'deleted_at' => NULL, 'archived' => '0', 'warranty_months' => NULL, 'depreciate' => '0');
     // RTD (status_id =0, assigned_to = 0)
     $asset[] = array('name' => 'Brady MBP', 'asset_tag' => 'NNY78795566', 'model_id' => 2, 'serial' => 'WS9078686069', 'purchase_date' => '2012-01-02', 'purchase_cost' => '1999.99', 'order_number' => '657756', 'created_at' => $date->modify('-10 day'), 'updated_at' => $date->modify('-3 day'), 'user_id' => 1, 'assigned_to' => 0, 'physical' => 1, 'archived' => 0, 'status_id' => 0, 'notes' => '', 'deleted_at' => NULL, 'archived' => '0', 'warranty_months' => NULL, 'depreciate' => '0');
     // RTD (status_id =0, assigned_to = 0)
     $asset[] = array('name' => 'Deborah MBP', 'asset_tag' => 'NNY65756756775', 'model_id' => 2, 'serial' => 'WS9078686069', 'purchase_date' => '2012-01-02', 'purchase_cost' => '699.99', 'order_number' => '657756', 'created_at' => $date->modify('-10 day'), 'updated_at' => $date->modify('-3 day'), 'user_id' => 2, 'assigned_to' => 0, 'physical' => 1, 'archived' => 0, 'status_id' => 0, 'notes' => '', 'deleted_at' => NULL, 'archived' => '0', 'warranty_months' => NULL, 'depreciate' => '0');
     // Deployed (status_id =0, assigned_to > 0)
     $asset[] = array('name' => 'Sara MBP', 'asset_tag' => 'NNY6897856775', 'model_id' => 2, 'serial' => 'WS87897998Q', 'purchase_date' => '2012-01-02', 'purchase_cost' => '1999.99', 'order_number' => '657756', 'created_at' => $date->modify('-10 day'), 'updated_at' => $date->modify('-3 day'), 'user_id' => 2, 'assigned_to' => 2, 'physical' => 1, 'archived' => 0, 'status_id' => 0, 'notes' => '', 'deleted_at' => NULL, 'archived' => '0', 'warranty_months' => NULL, 'depreciate' => '0');
     // Deployed (status_id =0, assigned_to > 0)
     $asset[] = array('name' => 'Ben MBP', 'asset_tag' => 'NNY67567775', 'model_id' => 2, 'serial' => 'WS89080890', 'purchase_date' => '2012-01-02', 'purchase_cost' => '1999.99', 'order_number' => '657756', 'created_at' => $date->modify('-10 day'), 'updated_at' => $date->modify('-3 day'), 'user_id' => 2, 'assigned_to' => 2, 'physical' => 1, 'archived' => 0, 'status_id' => 0, 'notes' => '', 'deleted_at' => NULL, 'archived' => '0', 'warranty_months' => NULL, 'depreciate' => '0');
     // Undeployable (status_id > 0, assigned_to = 0)
     $asset[] = array('name' => 'Broke-Ass Laptop', 'asset_tag' => 'NNY67567775', 'model_id' => 2, 'serial' => 'WS89080890', 'purchase_date' => '2012-01-02', 'purchase_cost' => '1999.99', 'order_number' => '657756', 'created_at' => $date->modify('-10 day'), 'updated_at' => $date->modify('-3 day'), 'user_id' => 2, 'assigned_to' => 0, 'physical' => 1, 'archived' => 0, 'status_id' => '3', 'notes' => '', 'deleted_at' => NULL, 'archived' => '0', 'warranty_months' => NULL, 'depreciate' => '0');
     // Undeployable (status_id > 0, assigned_to = 0)
     $asset[] = array('name' => 'Maybe Broke-Ass Laptop', 'asset_tag' => 'NNY6755667775', 'model_id' => 2, 'serial' => 'WS45689080890', 'purchase_date' => '2012-01-02', 'purchase_cost' => '1999.99', 'order_number' => '657756', 'created_at' => $date->modify('-10 day'), 'updated_at' => $date->modify('-3 day'), 'user_id' => 1, 'assigned_to' => 0, 'physical' => 1, 'archived' => 0, 'status_id' => '2', 'notes' => '', 'deleted_at' => NULL, 'archived' => '0', 'warranty_months' => NULL, 'depreciate' => '0');
     // Undeployable (status_id > 0, assigned_to = 0)
     $asset[] = array('name' => 'Completely Facacta Laptop', 'asset_tag' => 'NNY6564567775', 'model_id' => 2, 'serial' => 'WS99689080890', 'purchase_date' => '2012-01-02', 'purchase_cost' => '1999.99', 'order_number' => '657756', 'created_at' => $date->modify('-10 day'), 'updated_at' => $date->modify('-3 day'), 'user_id' => 1, 'assigned_to' => 0, 'physical' => 1, 'archived' => 1, 'status_id' => '4', 'notes' => '', 'deleted_at' => NULL, 'archived' => '0', 'warranty_months' => NULL, 'depreciate' => '0');
     // Undeployable (status_id > 0, assigned_to = 0)
     $asset[] = array('name' => 'Drunken Shanenigans Laptop', 'asset_tag' => 'NNY6564567775', 'model_id' => 2, 'serial' => 'WS99689080890', 'purchase_date' => '2012-01-02', 'purchase_cost' => '1999.99', 'order_number' => '657756', 'created_at' => $date->modify('-10 day'), 'updated_at' => $date->modify('-3 day'), 'user_id' => 1, 'assigned_to' => 0, 'physical' => 1, 'archived' => 1, 'status_id' => '3', 'notes' => '', 'deleted_at' => NULL, 'archived' => '0', 'warranty_months' => NULL, 'depreciate' => '0');
     // Almost out of warranty example
     $asset[] = array('name' => 'Noah MBP', 'asset_tag' => 'NNY98056775', 'model_id' => 2, 'serial' => 'WS909098888', 'purchase_date' => '2011-12-20', 'purchase_cost' => '699.99', 'order_number' => '657756', 'created_at' => $date->modify('-10 day'), 'updated_at' => $date->modify('-3 day'), 'user_id' => 2, 'assigned_to' => 0, 'physical' => 1, 'archived' => 0, 'status_id' => 0, 'notes' => '', 'deleted_at' => NULL, 'archived' => '0', 'warranty_months' => '24', 'depreciate' => '0');
     // Delete all the old data
     DB::table('assets')->truncate();
     // Insert the new posts
     Asset::insert($asset);
 }
Example #29
0
 public function __construct()
 {
     // Asset::add('jquery.dropdown.css', 'css/jquery.dropdown.css');
     Asset::add('bootstrap', 'css/bootstrap.min.css');
     Asset::add('bootstrap-responsive', 'css/bootstrap-responsive.css');
     Asset::add('common', 'css/common.css');
     // Asset::add('style', 'css/style.css');
     Asset::add('fontawsome', 'css/fontawesome.css');
     Asset::add('flickcss', 'css/flick/jquery-ui-1.10.2.custom.css');
     Asset::add('jquery', 'js/jquery-1.9.1.js');
     Asset::add('jquery-migrate-1.1.1.js', 'js/jquery-migrate-1.1.1.js');
     Asset::add('bootstrap-js', 'js/bootstrap.js');
     Asset::add('jqueryui', 'js/jquery-ui-1.10.2.custom.min.js');
     Asset::add('jquery.tablesorter.js', 'js/jquery.tablesorter.js');
     Asset::add('jquery.tablesorter.pager.js', 'js/jquery.tablesorter.pager.js');
     // $files = glob("public/css/pikachoose/*.css", GLOB_BRACE);
     // foreach($files as $file)
     // {
     // 	Asset::add($file, substr($file, 7));
     // }
     if (Session::has('id') && Auth::check()) {
         $account = Account::find(Session::get('id'));
         if ($account->admin == 1) {
             Session::put('admin', '1');
         } else {
             Session::put('admin', '0');
         }
         if ($account->blocked == 1) {
             Session::put('alert', "Your account has been banned. Please contact the admin for more details");
             Session::forget('id');
             Auth::logout();
         } else {
         }
     }
 }
 /**
  * @return null|object|Asset
  * get singleton instance
  */
 public static function getInstance()
 {
     if (!self::$instance) {
         self::$instance = new Asset();
     }
     return self::$instance;
 }