예제 #1
0
파일: DevLogger.php 프로젝트: mpf-soft/mpf
 public function onShutDown()
 {
     if (WebApp::get()->request()->isAjaxRequest() || self::$ignoreOutput) {
         return;
     }
     $url = AssetsPublisher::get()->publishFolder(__DIR__ . DIRECTORY_SEPARATOR . 'devloggerassets/');
     $numbers = ['all' => count($this->logs), 'error' => '0', 'debug' => '0', 'info' => '0', 'query' => '0'];
     foreach ($this->logs as $log) {
         switch ($log['level']) {
             case Levels::ERROR:
             case Levels::ALERT:
             case Levels::CRITICAL:
             case Levels::EMERGENCY:
             case Levels::NOTICE:
             case Levels::WARNING:
                 $numbers['error']++;
                 break;
             case Levels::INFO:
                 $numbers['info']++;
                 break;
             case Levels::DEBUG:
                 if (isset($log['context']['fromClass']) && 'mpf\\datasources\\sql\\PDOConnection' == $log['context']['fromClass']) {
                     $numbers['query']++;
                 } else {
                     $numbers['debug']++;
                 }
                 break;
         }
     }
     $json = json_encode($this->logs);
     $time = number_format(microtime(true) - WebApp::get()->startTime, 4);
     echo Html::get()->cssFile($url . 'style.css') . Html::get()->mpfScriptFile('jquery.js') . Html::get()->scriptFile($url . 'script.js') . Html::get()->script("var DevLogger_RunTime = {$time}; \n" . "var DevLogger_Numbers = { all : {$numbers['all']}, error : {$numbers['error']}, debug : {$numbers['debug']}, info : {$numbers['info']}, query : {$numbers['query']} }; \n" . "var DevLogger_Logs = " . $json);
 }
예제 #2
0
 public function display()
 {
     $columns = $this->initColumns();
     $t = Html::get()->cssFile(AssetsPublisher::get()->publishFolder(__DIR__ . DIRECTORY_SEPARATOR . 'assets') . 'table.css');
     $content = array();
     foreach ($columns as $column) {
         /* @var $column \mpf\widgets\viewtable\columns\Basic */
         $content[] = $column->display();
     }
     $content = implode("\n", $content);
     $this->htmlOptions['class'] = 'm-viewtable m-viewtable-' . $this->theme;
     return $t . Html::get()->tag('div', Html::get()->tag('table', $content, $this->tableHtmlOptions), $this->htmlOptions);
 }
예제 #3
0
 public function publishAssets()
 {
     $this->assetsURL = AssetsPublisher::get()->publishFolder(__DIR__ . DIRECTORY_SEPARATOR . $this->assetsFolder);
     echo HtmlHelper::get()->cssFile($this->getAssetsURL() . 'style.css') . HtmlHelper::get()->mpfScriptFile('jquery.js') . HtmlHelper::get()->scriptFile($this->getAssetsURL() . 'form.js');
 }
예제 #4
0
<?php

$actions = array('index' => 'View All', 'create' => 'New User');
$menu = array();
foreach ($actions as $action => $label) {
    $menu[] = array('url' => array('users', $action), 'label' => $label, 'htmlOptions' => $action == $this->getActiveAction() ? array('class' => 'selected') : array());
}
echo \app\components\htmltools\Page::title('Users - ' . $actions[$this->getActiveAction()], $menu);
\mpf\widgets\datatable\Table::get(array('dataProvider' => $model->getDataProvider(), 'multiSelect' => true, 'multiSelectActions' => array('delete' => ['label' => 'Delete', 'icon' => \mpf\web\AssetsPublisher::get()->mpfAssetFile('images/oxygen/16x16/actions/edit-delete.png'), 'shortcut' => 'Shift+Delete', 'url' => \mpf\WebApp::get()->request()->createURL("users", "delete"), 'confirmation' => 'Are you sure?'], 'enable' => ['label' => 'Enable', 'icon' => \mpf\web\AssetsPublisher::get()->mpfAssetFile('images/oxygen/16x16/actions/dialog-ok-apply.png'), 'url' => \mpf\WebApp::get()->request()->createURL("users", "index")], 'disable' => ['label' => 'Disable', 'icon' => \mpf\web\AssetsPublisher::get()->mpfAssetFile('images/oxygen/16x16/actions/dialog-cancel.png'), 'url' => \mpf\WebApp::get()->request()->createURL("users", "index")], 'join' => ['label' => 'Join Accounts', 'icon' => \mpf\web\AssetsPublisher::get()->mpfAssetFile('images/oxygen/16x16/actions/im-msn.png'), 'url' => \mpf\WebApp::get()->request()->createURL("users", "merge"), 'confirmation' => 'Are you sure? After this user can log in on any of those accounts and see data from all of them.[where this is supported]']), 'columns' => array('name', 'email', 'register_date' => array('class' => 'Date'), 'last_login' => array('class' => 'Date'), 'last_login_source' => array('filter' => array('post' => 'POST', 'cookie' => 'Cookie', 'facebook' => 'Facebook', 'google' => 'Google')), 'status' => array('class' => 'Select', 'filter' => \app\models\User::getStatuses()), array('class' => 'Actions', 'buttons' => array('delete' => array('class' => 'Delete'), 'edit' => array('class' => 'Edit'), 'view' => array('class' => 'View')), 'headerHtmlOptions' => array('style' => 'width:60px;'), 'topButtons' => array('add' => array('class' => 'Add'))))))->display();
예제 #5
0
<?php

$actions = array('index' => 'View All', 'create' => 'Add Group');
$menu = array();
foreach ($actions as $action => $label) {
    $menu[] = array('url' => array('usergroups', $action), 'label' => $label, 'htmlOptions' => $action == $this->getActiveAction() ? array('class' => 'selected') : array());
}
echo \app\components\htmltools\Page::title('Users Groups - ' . $actions[$this->getActiveAction()], $menu);
\mpf\widgets\datatable\Table::get(array('dataProvider' => $model->getDataProvider(), 'multiSelect' => true, 'multiSelectActions' => array('delete' => array('label' => 'Delete', 'icon' => \mpf\web\AssetsPublisher::get()->mpfAssetFile('images/oxygen/16x16/actions/edit-delete.png'), 'shortcut' => 'Shift+Delete', 'url' => \mpf\WebApp::get()->request()->createURL("usergroups", "delete"))), 'columns' => array('id' => array('headerHtmlOptions' => array('style' => 'width:60px;'), 'htmlOptions' => array('style' => 'text-align:center;')), 'name', 'label', array('class' => 'Actions', 'headerHtmlOptions' => array('style' => 'width:40px;'), 'buttons' => array('edit' => array('class' => 'Edit'), 'delete' => array('class' => 'Delete')), 'topButtons' => array('add' => array('class' => 'Add'))))))->display();
예제 #6
0
 public function log($level, $message, array $context = array())
 {
     $details = array();
     $context['time'] = microtime(true);
     foreach ($context as $k => $v) {
         $details[] = $k . ' : ' . (is_string($v) ? nl2br($v) : print_r($v, true));
     }
     $details = implode('<br />', $details);
     echo "<div class=\"log-message log-{$level}\"><b>{$level} : {$message}</b><span><br />{$details}</span></div>";
     $baseScriptsURL = \mpf\web\AssetsPublisher::get()->publishFolder(dirname(\mpf\base\AutoLoader::getLastRegistered()->path('\\mpf\\__assets\\scripts\\jquery')) . DIRECTORY_SEPARATOR . 'jquery');
     echo \mpf\web\helpers\Html::get()->scriptFile($baseScriptsURL . 'jquery.min.js');
     echo \mpf\web\helpers\Html::get()->script('$(document).ready(function(){' . '$(".log-message").click(function(){if ($("span", this).is(":visible")) {$("span", this).hide();} else {$("span", this).show();} })' . '})');
 }
예제 #7
0
 protected function getForm($row, Table $table)
 {
     $this->formHTMLOptions['style'] = (isset($this->formHTMLOptions['style']) ? $this->formHTMLOptions['style'] : '') . 'display:none;';
     $this->formHTMLOptions['method'] = 'post';
     $this->formHTMLOptions['is-ajax'] = $this->ajax ? '1' : '0';
     $this->formHTMLOptions['action'] = $this->url ? is_array($this->url) ? WebApp::get()->request()->createURL($this->url[0], $this->url[1], isset($this->url[2]) ? $this->url[2] : [], isset($this->url[3]) ? $this->url[3] : null) : $this->url : '';
     $form = Form::get()->openForm($this->formHTMLOptions);
     switch ($this->type) {
         case 'input':
         case 'password':
         case 'email':
             $form .= Form::get()->input($this->name, str_replace('input', 'text', $this->type), $row->{$this->name}, $this->inputHTMLOptions);
             break;
         case 'date':
             $form .= Form::get()->input($this->name, str_replace('input', 'date', $this->type), $row->{$this->name}, $this->inputHTMLOptions);
             break;
         case 'select':
             $form .= Form::get()->select($this->name, $this->options, $row->{$this->name}, $this->inputHTMLOptions);
             break;
         case 'default':
             trigger_error("Invalid type {$this->type}!");
             break;
     }
     $form .= Form::get()->hiddenInput($this->key, $row->{$this->key});
     $this->saveButtonIcon = str_replace(array('%DATATABLE_ASSETS%', '%SIZE%'), array($table->getAssetsURL(), $this->iconSize . 'x' . $this->iconSize), $this->saveButtonIcon);
     $this->cancelButtonIcon = str_replace(array('%DATATABLE_ASSETS%', '%SIZE%'), array($table->getAssetsURL(), $this->iconSize . 'x' . $this->iconSize), $this->cancelButtonIcon);
     if ('%MPF_ASSETS%' == substr($this->saveButtonIcon, 0, 12)) {
         $this->saveButtonIcon = AssetsPublisher::get()->mpfAssetFile(substr($this->saveButtonIcon, 12));
     }
     if ('%MPF_ASSETS%' == substr($this->cancelButtonIcon, 0, 12)) {
         $this->cancelButtonIcon = AssetsPublisher::get()->mpfAssetFile(substr($this->cancelButtonIcon, 12));
     }
     if ($this->showSaveButton) {
         $form .= Form::get()->imageButton($this->saveButtonIcon, $this->saveButtonLabel, '', '', ['class' => 'inline-save-button']);
     }
     if ($this->showCancelButton) {
         $form .= Form::get()->imageButton($this->cancelButtonIcon, $this->cancelButtonLabel, '', '', ['class' => 'inline-cancel-button']);
     }
     return $form . Form::get()->closeForm();
 }
예제 #8
0
 /**
  * 
  */
 public function display()
 {
     $this->assetsURL = \mpf\web\AssetsPublisher::get()->publishFolder(__DIR__ . DIRECTORY_SEPARATOR . $this->assetsFolder);
     echo \mpf\web\helpers\Html::get()->cssFile($this->assetsURL . 'style.css');
     $content = '';
     foreach ($this->instantiatedItems as $item) {
         /* @var $item \mpf\widgets\menu\items\Link */
         $content .= $item->display();
     }
     if (!isset($this->htmlOptions['class'])) {
         $this->htmlOptions['class'] = 'm-menu m-menu-' . $this->theme;
     } else {
         $this->htmlOptions['class'] = $this->htmlOptions['class'] . ' m-menu m-menu-' . $this->theme;
     }
     $menu = \mpf\web\helpers\Html::get()->tag('div', \mpf\web\helpers\Html::get()->tag('ul', $content, array('class' => 'm-menu-main-menu')), $this->htmlOptions);
     $menu .= Html::get()->script("\n    \$('li.m-menu-dropdown>a, li.m-menu-dropdown>span').click(function(e){\n        if (\$(this.parentNode).hasClass('dropdownvisible')){\n            \$(this.parentNode).removeClass('dropdownvisible');\n        } else {\n            \$('li', this.parentNode.parentNode).removeClass('dropdownvisible');\n            \$(this.parentNode).addClass('dropdownvisible');\n        }\n        e.preventDefault();\n        return false;\n    });\n    \$(document).click(function(){\n        \$('li').removeClass('dropdownvisible');\n    });\n        ");
     echo $menu;
 }
예제 #9
0
파일: Html.php 프로젝트: mpf-soft/mpf
 /**
  * @param string $name
  * @param string $title
  * @param array $htmlOptions
  * @return string
  */
 public function mpfImage($name, $title = '', $htmlOptions = [])
 {
     return $this->image(AssetsPublisher::get()->mpfAssetFile('images/' . $name), $title, $htmlOptions);
 }
예제 #10
0
 public function getPageLink($pageNo, $type)
 {
     if (!in_array($type, array('next', 'first', 'previous', 'last'))) {
         trigger_error('Invalid page type ' . $type . '!');
     }
     $icon = $this->{$type . 'PageIcon'};
     if (false === strpos($icon, '/')) {
         $label = $this->translate($icon);
     } else {
         $icon = str_replace('%DATATABLE_ASSETS%', $this->getAssetsURL(), $icon);
         if ('%MPF_ASSETS%' == substr($icon, 0, 12)) {
             $icon = AssetsPublisher::get()->mpfAssetFile(substr($icon, 12));
         }
         $label = Html::get()->image($icon, $this->translate('Page') . ' ' . $pageNo);
     }
     return $this->dataProvider->getLinkForPage($pageNo, $label);
 }
예제 #11
0
 /**
  * Get HTML code for header
  * @param Table $table
  * @return string
  */
 public function getHeaderCode(\mpf\widgets\datatable\Table $table)
 {
     $label = $this->getLabel();
     if (!$this->order) {
         return $label;
     }
     $order = $this->dataProvider->getOrder();
     $prefix = '';
     $this->iconArrowUp = str_replace(array('%DATATABLE_ASSETS%', '%SIZE%'), array($table->getAssetsURL(), $this->iconSize . 'x' . $this->iconSize), $this->iconArrowUp);
     $this->iconArrowDown = str_replace(array('%DATATABLE_ASSETS%', '%SIZE%'), array($table->getAssetsURL(), $this->iconSize . 'x' . $this->iconSize), $this->iconArrowDown);
     if ('%MPF_ASSETS%' == substr($this->iconArrowUp, 0, 12)) {
         $this->iconArrowUp = AssetsPublisher::get()->mpfAssetFile(substr($this->iconArrowUp, 12));
     }
     if ('%MPF_ASSETS%' == substr($this->iconArrowDown, 0, 12)) {
         $this->iconArrowDown = AssetsPublisher::get()->mpfAssetFile(substr($this->iconArrowDown, 12));
     }
     if ($order[0] == (is_string($this->order) ? $this->order : '`' . $this->name . '`')) {
         $prefix = 'ASC' == $order[1] ? Html::get()->image($this->iconArrowUp, 'Order Descendent', ['class' => 'order-by-img']) : Html::get()->image($this->iconArrowDown, 'Order Ascendent', ['class' => 'order-by-img']);
     }
     return $this->dataProvider->getColumnOrderLink(is_string($this->order) ? $this->order : '`' . $this->name . '`', $prefix . $label);
 }
예제 #12
0
<?php

echo \app\components\htmltools\Page::title('Config');
\mpf\widgets\datatable\Table::get(array('dataProvider' => $model->getDataProvider(), 'multiSelect' => true, 'multiSelectActions' => array('editconfig' => array('label' => 'Edit', 'icon' => \mpf\web\AssetsPublisher::get()->mpfAssetFile('images/oxygen/16x16/actions/document-edit.png'), 'url' => \mpf\WebApp::get()->request()->createURL("admin", "editconfig"))), 'columns' => array('name', 'value', 'lastupdate_date' => array('class' => 'Date'), 'lastupdate_user' => array('value' => '$row->lastupdate_user?$row->admin->name:"<i>-none-</i>"'), array('class' => 'Actions', 'buttons' => array('edit' => array('class' => 'Edit', 'url' => "\\mpf\\WebApp::get()->request()->createURL(\\mpf\\WebApp::get()->request()->getController(), 'editconfig', array('id' => \$row->id))")), 'headerHtmlOptions' => array('style' => 'width:20px;')))))->display();
예제 #13
0
 /**
  * Get HTML img tag for icon or an empty string if there is no icon
  * @param string $title
  * @param \mpf\widgets\datatable\Table $table
  * @return string
  */
 public function getIcon($title, Table $table)
 {
     if ($this->icon) {
         $icon = str_replace(array('%DATATABLE_ASSETS%', '%SIZE%'), array($table->getAssetsURL(), $this->iconSize . 'x' . $this->iconSize), $this->icon);
         if ('%MPF_ASSETS%' == substr($icon, 0, 12)) {
             $icon = AssetsPublisher::get()->mpfAssetFile(substr($icon, 12));
         }
         return Html::get()->image($icon, $title);
     }
     return '';
 }
예제 #14
0
echo \mpf\web\helpers\Html::get()->mpfCssFile('../scripts/jquery-ui/themes/' . \mpf\web\helpers\Html::get()->jqueryUITheme . '/jquery-ui.css');
?>
    <?php 
echo \mpf\web\helpers\Html::get()->mpfScriptFile('jquery-ui/jquery-ui.js');
?>
    <?php 
echo \mpf\web\helpers\Html::get()->scriptFile(\mpf\WebApp::get()->request()->getWebRoot() . 'admin/main.js');
?>
</head>
<body>
<div id="wrapper">
    <div id="site">
        <div id="header">
            <div id="header-bar">
                <h1><?php 
echo \mpf\web\helpers\Html::get()->link(\mpf\WebApp::get()->request()->getLinkRoot(), \mpf\WebApp::get()->title);
?>
</h1>
            </div>
            <div id="menu-bar">
                <?php 
\mpf\widgets\menu\Menu::get(['items' => [['url' => [], 'label' => 'Home'], ['url' => ['user', 'login'], 'label' => 'Login', 'visible' => \mpf\WebApp::get()->user()->isGuest()], ['url' => ['user', 'forgotpassword'], 'label' => 'Forgot Password', 'visible' => \mpf\WebApp::get()->user()->isGuest()], ['class' => 'Label', 'label' => 'Admin', 'visible' => \mpf\WebApp::get()->user()->isConnected(), 'items' => [['url' => ['users', 'index'], 'label' => 'Users', 'visible' => \mpf\WebApp::get()->user()->isConnected(), 'items' => [['url' => ['users', 'index'], 'label' => 'Manage Users'], ['url' => ['users', 'create'], 'label' => 'New User'], ['url' => ['usergroups', 'index'], 'label' => 'Manage Groups'], ['url' => ['usergroups', 'create'], 'label' => 'New Group'], ['url' => ['usertitles', 'index'], 'label' => 'Manage Titles'], ['url' => ['usertitles', 'create'], 'label' => 'New Title']], 'icon' => \mpf\web\AssetsPublisher::get()->mpfAssetFile('images/oxygen/22x22/apps/system-users.png')], ['url' => ['admin', 'config'], 'label' => 'Config', 'icon' => \mpf\web\AssetsPublisher::get()->mpfAssetFile('images/oxygen/22x22/categories/preferences-other.png')], ['url' => ['admin', 'crontab'], 'label' => 'Crontab', 'icon' => \mpf\web\AssetsPublisher::get()->mpfAssetFile('images/oxygen/22x22/categories/applications-system.png')]]], ['class' => 'Label', 'label' => \mpf\WebApp::get()->user()->isGuest() ? 'Welcome Guest!' : 'Welcome ' . \mpf\WebApp::get()->user()->name, 'htmlOptions' => ['style' => 'float:right;'], 'items' => [['url' => ['user', 'profile'], 'label' => 'My Profile', 'icon' => \mpf\web\AssetsPublisher::get()->mpfAssetFile('images/oxygen/22x22/apps/preferences-desktop-user.png')], ['url' => ['user', 'edit'], 'label' => 'Edit My Profile', 'icon' => \mpf\web\AssetsPublisher::get()->mpfAssetFile('images/oxygen/22x22/apps/accessories-text-editor.png')], ['url' => ['user', 'email'], 'label' => 'Change Email', 'icon' => \mpf\web\AssetsPublisher::get()->mpfAssetFile('images/oxygen/22x22/status/mail-unread.png')], ['url' => ['user', 'password'], 'label' => 'Change Password', 'icon' => \mpf\web\AssetsPublisher::get()->mpfAssetFile('images/oxygen/22x22/actions/system-lock-screen.png')], ['url' => ['user', 'logout'], 'label' => 'Logout', 'icon' => \mpf\web\AssetsPublisher::get()->mpfAssetFile('images/oxygen/22x22/status/task-reject.png')]]], ['label' => 'Google Login', 'url' => $url = \mpf\WebApp::get()->user()->getGoogleClient() ? \mpf\WebApp::get()->user()->getGoogleClient()->createAuthUrl() : null, 'htmlOptions' => ['style' => 'float:right;'], 'linkHtmlOptions' => ['class' => 'ext-login-button google-login-button'], 'visible' => \mpf\WebApp::get()->user()->isGuest() && trim($url)], ['label' => 'Facebook Login', 'url' => $url = \mpf\WebApp::get()->user()->getFacebookLoginURL(), 'visible' => \mpf\WebApp::get()->user()->isGuest() && trim($url), 'htmlOptions' => ['style' => 'float:right;'], 'linkHtmlOptions' => ['class' => 'ext-login-button facebook-login-button']]]])->display();
?>
            </div>
        </div>
        <div id="content">
            <?php 
echo \app\components\htmltools\Messages::get()->display();
?>

예제 #15
0
<?php

$actions = array('crontab' => 'View All', 'addcron' => 'Add Job');
$menu = array();
foreach ($actions as $action => $label) {
    $menu[] = array('url' => array('admin', $action), 'label' => $label, 'htmlOptions' => $action == \mpf\WebApp::get()->request()->getAction() ? array('class' => 'selected') : array());
}
echo \app\components\htmltools\Page::title('Crontab - ' . $actions[\mpf\WebApp::get()->request()->getAction()], $menu);
\mpf\widgets\datatable\Table::get(array('dataProvider' => $model->getDataProvider(), 'multiSelect' => true, 'multiSelectActions' => array('delete' => array('label' => 'Delete', 'icon' => \mpf\web\AssetsPublisher::get()->mpfAssetFile('images/oxygen/16x16/actions/edit-delete.png'), 'shortcut' => 'Shift+Delete', 'url' => \mpf\WebApp::get()->request()->createURL("admin", "delete")), 'view' => array('label' => 'View', 'icon' => \mpf\web\AssetsPublisher::get()->mpfAssetFile('images/oxygen/16x16/actions/document-preview.png'), 'shortcut' => 'Ctrl+V', 'url' => \mpf\WebApp::get()->request()->createURL("admin", "view")), 'enable' => array('label' => 'Enable', 'icon' => \mpf\web\AssetsPublisher::get()->mpfAssetFile('images/oxygen/16x16/actions/dialog-ok-apply.png'), 'url' => \mpf\WebApp::get()->request()->createURL("admin", "crontab")), 'disable' => array('label' => 'Disable', 'icon' => \mpf\web\AssetsPublisher::get()->mpfAssetFile('images/oxygen/16x16/actions/dialog-cancel.png'), 'url' => \mpf\WebApp::get()->request()->createURL("admin", "crontab"))), 'columns' => array('user' => array('headerHtmlOptions' => array('style' => 'width:75px;')), 'interval', 'command', 'log', array('class' => 'Actions', 'buttons' => array('preview' => array('icon' => \mpf\web\AssetsPublisher::get()->mpfAssetFile('images/oxygen/16x16/places/document-multiple.png'), 'title' => '"Last logs preview"', 'jsAction' => 'crontabLogPreview', 'url' => "\\mpf\\WebApp::get()->request()->createURL(\\mpf\\WebApp::get()->request()->getController(), 'cronlogpreview', array('id' => \$row->id))")), 'headerHtmlOptions' => array('style' => 'width:20px;')), 'enabled' => array('filter' => array('No', 'Yes'), 'value' => '$row->enabled?"<span style=\'color:limegreen;\'>Yes</span>":"<span style=\'color:orangered;\'>No</span>";'), 'laststart' => array('class' => 'Date'), array('class' => 'Actions', 'buttons' => array('delete' => array('class' => 'Delete'), 'edit' => array('class' => 'Edit', 'url' => "\\mpf\\WebApp::get()->request()->createURL(\\mpf\\WebApp::get()->request()->getController(), 'editcron', array('id' => \$row->id))"), 'view' => array('class' => 'View'), 'run' => array('title' => '"Run job"', 'url' => "\\mpf\\WebApp::get()->request()->createURL(\\mpf\\WebApp::get()->request()->getController(), 'execcron', array('id' => \$row->id))", 'icon' => \mpf\web\AssetsPublisher::get()->mpfAssetFile('images/oxygen/16x16/actions/system-run.png'))), 'headerHtmlOptions' => array('style' => 'width:80px;'), 'topButtons' => array('add' => array('class' => 'Add', 'url' => \mpf\WebApp::get()->request()->createURL('admin', 'addcron')))))))->display();
?>
<div style="display: none;" id="log-dialog" title="Log Preview"><i>loading</i></div>
예제 #16
0
 /**
  * Returns the HTML code for the element.
  * @return string
  */
 public function display()
 {
     $source = str_replace(['{VENDOR}', '{APP_ROOT}'], [LIBS_FOLDER, APP_ROOT], $this->jsSource);
     $url = AssetsPublisher::get()->publishFolder($source);
     $events = $this->getJSEvents();
     $r = Form::get()->input($this->name . '[]', 'file', null, ['id' => $this->id, 'data-url' => $this->dataUrl, 'multiple' => 'multiple']) . Html::get()->scriptFile($url . "js/vendor/jquery.ui.widget.js") . Html::get()->scriptFile($url . "js/jquery.iframe-transport.js") . Html::get()->scriptFile($url . "js/jquery.fileupload.js") . Html::get()->script("\$(function () {\n    \$('#{$this->id}').fileupload({\n        dataType: 'json' " . (isset($this->jsEventsHandlers['fileuploaddone']) ? '' : ",\n        done: function (e, data) {\n            \$.each(data.result.files, function (index, file) {\n                \$('<p/>').text(file.name).appendTo(\$(\"#{$this->resultsId}\"));\n            });\n        }") . "\n    }){$events};\n});");
     if ($this->generateResultsDiv) {
         $r .= Html::get()->tag("div", "", ["id" => $this->resultsId]);
     }
     return $r;
 }