Esempio n. 1
0
 public static function registerJS($includeJS)
 {
     if (is_string($includeJS)) {
         $includeJS = [$includeJS];
     }
     if (!empty($includeJS)) {
         foreach ($includeJS as $js) {
             $jspath = realpath(Asset::resolveAlias($js));
             if (is_dir($jspath)) {
                 $path = Asset::publish($jspath);
                 $files = glob($jspath . "/*");
                 foreach ($files as $p) {
                     if (pathinfo($p, PATHINFO_EXTENSION) != "js") {
                         continue;
                     }
                     $p = str_replace($jspath, '', realpath($p));
                     Yii::app()->clientScript->registerScriptFile($path . str_replace("\\", "/", $p), CClientScript::POS_END);
                 }
             } else {
                 if (is_file($jspath)) {
                     Yii::app()->clientScript->registerScriptFile(Asset::publish($jspath), CClientScript::POS_END);
                 }
             }
         }
     }
 }
Esempio n. 2
0
 /**
  * @return array Fungsi ini akan melakukan render script dan me-return array $html.
  */
 public function renderScript()
 {
     $includeJS = $this->includeJS();
     $html = [];
     if (count($includeJS) > 0) {
         foreach ($includeJS as $js) {
             $class = get_class($this);
             $html[] = Asset::publish(Yii::getPathOfAlias("application.components.ui.Widgets.{$class}") . '/' . $js);
         }
     }
     return $html;
 }
Esempio n. 3
0
 public static function listTemplates()
 {
     $dir = Yii::getPathOfAlias('application.components.codegen.templates');
     $glob = array_slice(scandir($dir), 2);
     $list = [];
     foreach ($glob as $k => $l) {
         $t = [];
         $t['name'] = $l;
         $t['icon'] = Asset::publish($dir . "/" . $l . "/icon.png");
         $list[] = $t;
     }
     return $list;
 }
Esempio n. 4
0
            <i style="float:left;margin:8px 3px 0px -10px;" class="fa fa-fw <?php 
    echo $icon;
    ?>
"></i>
        <?php 
}
?>
        <?php 
echo $title;
?>
    </div>

    <div ui-content>
        <div oc-lazy-load="{name: 'ng-context-menu', files: [
             '<?php 
echo Asset::publish('application.components.ui.MenuTree.ng-contextmenu.js', true);
?>
'
             ]}">
            <div oc-lazy-load="{name: 'ui.tree', files: ['<?php 
echo $this->staticUrl('/js/lib/angular.ui.tree.js');
?>
']}">
                <script type="text/ng-template"
                id="<?php 
echo $class;
?>
MenuTreeLoop"><?php 
include 'menu_layout.php';
?>
</script>
Esempio n. 5
0
 /**
  * @param boolean $isAjax
  */
 public function renderAdditionalJS($isAjax = false)
 {
     $reflector = new ReflectionClass($this->model);
     $formDir = dirname($reflector->getFileName()) . DIRECTORY_SEPARATOR;
     if (count(@$this->form['includeJS']) > 0) {
         foreach ($this->form['includeJS'] as $script) {
             $src = $formDir . $script;
             if (is_file($src)) {
                 $scriptUrl = Asset::publish($src);
                 if ($isAjax) {
                     echo '
                 <script type="text/javascript" src="' . $scriptUrl . '"></script>';
                 } else {
                     Yii::app()->clientScript->registerScriptFile($scriptUrl, CClientScript::POS_END);
                 }
             }
         }
     }
 }
Esempio n. 6
0
 public static function registerCSS($includeCSS)
 {
     if (is_string($includeCSS)) {
         $includeCSS = [$includeCSS];
     }
     if (!empty($includeCSS)) {
         foreach ($includeCSS as $css) {
             $path = Asset::resolveAlias($css);
             if (is_file($path . ".css")) {
                 $file = $path . ".css";
                 if (strpos($file, Setting::getRootPath()) === 0) {
                     $file = substr($file, strlen(Setting::getRootPath()));
                     $file = Yii::app()->baseUrl . $file;
                 }
                 Yii::app()->clientScript->registerCssFile($file);
                 continue;
             }
             $csspath = realpath($path);
             if (is_dir($csspath)) {
                 $path = Asset::publish($csspath);
                 $files = glob($csspath . "/*");
                 foreach ($files as $p) {
                     if (pathinfo($p, PATHINFO_EXTENSION) != "css") {
                         continue;
                     }
                     $p = str_replace($csspath, '', realpath($p));
                     Yii::app()->clientScript->registerCssFile($path . str_replace("\\", "/", $p));
                 }
             } else {
                 if (is_file($csspath)) {
                     Yii::app()->clientScript->registerCssFile(Asset::publish($csspath));
                 }
             }
         }
     }
 }
Esempio n. 7
0
 /**
  * @return array Fungsi ini akan melakukan render script dan me-return array $html.
  */
 public function renderScript()
 {
     $includeJS = $this->includeJS();
     $html = [];
     if (count($includeJS) > 0) {
         foreach ($includeJS as $js) {
             $class = get_class($this);
             $jspath = realpath(Yii::getPathOfAlias("application.components.ui.FormFields.{$class}") . '/' . $js);
             if (is_dir($jspath)) {
                 $path = Asset::publish($jspath);
                 $files = glob($jspath . "/*");
                 foreach ($files as $p) {
                     $p = str_replace($jspath, '', realpath($p));
                     $html[] = $path . str_replace("\\", "/", $p);
                 }
             } else {
                 $html[] = Asset::publish($jspath);
             }
         }
     }
     $includeCSS = $this->includeCSS();
     if (count($includeCSS) > 0) {
         foreach ($includeCSS as $css) {
             $class = get_class($this);
             $html[] = Asset::publish(Yii::getPathOfAlias("application.components.ui.FormFields.{$class}") . '/' . $css);
         }
     }
     return $html;
 }
Esempio n. 8
0
                    </div>
                </div>
            </div>
        </div>
        <div ui-layout-container style="padding:0px 0px 0px 1px;overflow:hidden;border:0px;">
            <div class="loading invisible">
                <span>
                    <b>
                        <i class="fa fa-refresh fa-spin"></i>  Loading {{active.name}}...
                    </b>
                </span>
            </div>
            <iframe src="<?php 
echo $this->createUrl('empty');
?>
" scrolling="no"
                    seamless="seamless" name="iframe" frameborder="0" class="invisible"
                    style="width:100%;height:100%;overflow:hidden;display:block;">
            </iframe>
        </div>
    </div>
</div>
<script>var actionFormList = <?php 
echo $this->actionFormList();
?>
;</script>
<script src="<?php 
echo Asset::publish('application.modules.dev.views.forms.index.js', true);
?>
"></script>