当前位置: 首页>>代码示例>>PHP>>正文


PHP Helper::explodeLast方法代码示例

本文整理汇总了PHP中Helper::explodeLast方法的典型用法代码示例。如果您正苦于以下问题:PHP Helper::explodeLast方法的具体用法?PHP Helper::explodeLast怎么用?PHP Helper::explodeLast使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Helper的用法示例。


在下文中一共展示了Helper::explodeLast方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getSubFormClass

 public function getSubFormClass()
 {
     if ($this->_subformClass == "") {
         $this->_subformClass = Helper::explodeLast(".", $this->subForm);
     }
     return $this->_subformClass;
 }
开发者ID:reggi49,项目名称:plansys,代码行数:7,代码来源:ModalDialog.php

示例2: validateSubForm

 public function validateSubForm()
 {
     $class = get_class($this);
     $fb = FormBuilder::load($class);
     $listView = $fb->findAllField(['type' => 'ListView']);
     foreach ($listView as $k => $lv) {
         ## if listview is valid
         if ((@$lv['fieldTemplate'] == "datasource" || @$lv["fieldTemplate"] == "form") && @$lv['templateForm'] != '') {
             if (isset($this->attributes[$lv['name']])) {
                 $items = $this->attributes[$lv['name']];
                 foreach ($items as $k => $item) {
                     Yii::import($lv['templateForm']);
                     $newClass = Helper::explodeLast(".", $lv['templateForm']);
                     $new = new $newClass();
                     $new->attributes = $item;
                     $new->validate();
                     if ($new->hasErrors()) {
                         foreach ($new->errors as $name => $errors) {
                             $this->addError($name, implode("<br> &bull; ", $errors));
                         }
                     }
                 }
             }
         }
     }
 }
开发者ID:rizabudi,项目名称:plansys,代码行数:26,代码来源:Form.php

示例3: renderSubForm

 public function renderSubForm()
 {
     $class = Helper::explodeLast(".", $this->subForm);
     if ($class == get_class($this)) {
         return '<center><i class="fa fa-warning"></i> Error Rendering SubForm: Subform can not be the same as its parent</center>';
     } else {
         ## render
         Yii::import($this->subForm);
         $ctrl = Yii::app()->controller;
         $ctrl->renderForm($class, null, [], ['layout' => '//layouts/blank']);
     }
 }
开发者ID:balitax,项目名称:plansys,代码行数:12,代码来源:PopupWindow.php

示例4: actionListField

 public function actionListField()
 {
     if (!@$_GET['class']) {
         echo json_encode([]);
         die;
     }
     $class = $_GET['class'];
     Yii::import($class);
     $class = Helper::explodeLast(".", $class);
     $model = new $class();
     $data = [];
     if (is_subclass_of($model, 'ActiveRecord')) {
         $formType = "ActiveRecord";
         $data = $class::model()->attributesList;
         unset($data['Relations']);
         unset($data['Properties']);
     } else {
         if (is_subclass_of($model, 'FormField')) {
             $formType = "FormField";
             $mf = new $class();
             $data = $mf->attributes;
             unset($data['type']);
         } else {
             if (is_subclass_of($model, 'Form')) {
                 $formType = "Form";
                 $mf = new $class();
                 $data = $mf->attributes;
                 unset($data['type']);
             }
         }
     }
     echo json_encode($data);
 }
开发者ID:rizabudi,项目名称:plansys,代码行数:33,代码来源:RelationField.php

示例5: listCmdForMenuTree

 public static function listCmdForMenuTree()
 {
     $list = ['' => '-- Choose Command ---'];
     $devMode = Setting::get('app.mode') === "plansys";
     /*
      ** Fetching all command files inside app.commands
      **/
     $cmdsDir = Yii::getPathOfAlias("app.commands") . DIRECTORY_SEPARATOR;
     $cmds = self::listCmdInDir('app', $cmdsDir);
     foreach ($cmds as $cmd) {
         $shortUrl = Helper::explodeLast(".", $cmd['url']);
         $list['App'][$cmd['class']] = $shortUrl;
     }
     /*
      ** Fetching all command files inside app.modules
      **/
     $dir = Yii::getPathOfAlias("app.modules") . DIRECTORY_SEPARATOR;
     $items = glob($dir . "*", GLOB_ONLYDIR);
     foreach ($items as $k => $f) {
         $label = str_replace($dir, "", $f);
         $classPath = $f . DIRECTORY_SEPARATOR . 'commands' . DIRECTORY_SEPARATOR . ucfirst($label) . 'Command.php';
         if (is_file($classPath)) {
             $cmdsDir = $f . DIRECTORY_SEPARATOR . "commands" . DIRECTORY_SEPARATOR;
             $cmds = self::listCmdInDir('app.' . $label, $cmdsDir);
             foreach ($cmds as $cmd) {
                 $parts = explode(".", $cmd['url']);
                 $shortUrl = end($parts);
                 $list['App - ' . $parts[2]][$cmd['class']] = $shortUrl;
             }
         }
     }
     if ($devMode) {
         /*
          ** Fetching all command files inside plansys.commands
          **/
         $cmdsDir = Yii::getPathOfAlias("application.commands") . DIRECTORY_SEPARATOR;
         $cmds = self::listCmdInDir('plansys', $cmdsDir);
         foreach ($cmds as $cmd) {
             $shortUrl = Helper::explodeLast(".", $cmd['url']);
             $list['Plansys'][$cmd['class']] = $shortUrl;
         }
         /*
          ** Fetching all command files inside plansys.modules
          **/
         $dir = Yii::getPathOfAlias("application.modules") . DIRECTORY_SEPARATOR;
         $items = glob($dir . "*", GLOB_ONLYDIR);
         foreach ($items as $k => $f) {
             $label = str_replace($dir, "", $f);
             $classPath = $f . DIRECTORY_SEPARATOR . 'commands' . DIRECTORY_SEPARATOR . ucfirst($label) . 'Command.php';
             if (is_file($classPath)) {
                 $cmdsDir = $f . DIRECTORY_SEPARATOR . "commands" . DIRECTORY_SEPARATOR;
                 $cmds = self::listCmdInDir('plansys.' . $label, $cmdsDir);
                 foreach ($cmds as $cmd) {
                     $parts = explode(".", $cmd['url']);
                     $shortUrl = end($parts);
                     $list['Plansys - ' . $parts[2]][$cmd['class']] = $shortUrl;
                 }
             }
         }
     }
     return $list;
 }
开发者ID:reggi49,项目名称:plansys,代码行数:62,代码来源:ProcessHelper.php

示例6: load

 /**
  * load
  * Fungsi ini digunakan untuk me-load FormBuilder
  * @param array $class
  * @param array $findByAttributes
  * @return mixed me-return null jika class tidak ada, jika ada maka me-return array $model
  */
 public static function load($class, $findByAttributes = [])
 {
     if (!is_string($class)) {
         return null;
     }
     $originalClass = $class;
     if (strpos($class, ".") !== false) {
         $classFile = FormBuilder::classPath($class);
         $class = Helper::explodeLast(".", $classFile);
         try {
             Yii::import($classFile);
         } catch (Exception $e) {
             if (isset(Yii::app()->controller) && isset(Yii::app()->controller->module)) {
                 $basePath = Yii::app()->controller->module->basePath;
                 $classFile = str_replace(".", DIRECTORY_SEPARATOR, $classFile) . ".php";
                 $classFile = $basePath . DIRECTORY_SEPARATOR . 'forms' . DIRECTORY_SEPARATOR . $classFile;
                 require_once $classFile;
             }
         }
         if (!class_exists($class)) {
             throw new CException("Class \"{$class}\" does not exists");
         }
     }
     $model = new FormBuilder();
     if (!empty($findByAttributes) && method_exists($class, 'model')) {
         if (is_subclass_of($class, 'ActiveRecord')) {
             $model->model = $class::model()->findByAttributes($findByAttributes);
             if (is_null($model->model)) {
                 $model->model = new $class();
             }
         }
     } else {
         $model->model = new $class();
     }
     $model->originalClass = $originalClass;
     if (!is_null($findByAttributes)) {
         $model->model->attributes = $findByAttributes;
     }
     ## get method line and length
     if (isset(Yii::app()->session)) {
         if (is_null(Yii::app()->session['FormBuilder_' . $originalClass])) {
             $reflector = new ReflectionClass($class);
             $model->sourceFile = $reflector->getFileName();
             $model->file = file($model->sourceFile, FILE_IGNORE_NEW_LINES);
             $methods = $reflector->getMethods();
             foreach ($methods as $m) {
                 if ($m->class == $class) {
                     $line = $m->getStartLine() - 1;
                     $length = $m->getEndLine() - $line;
                     $model->methods[$m->name] = ['line' => $line, 'length' => $length];
                 }
             }
             Yii::app()->session['FormBuilder_' . $originalClass] = ['sourceFile' => $model->sourceFile, 'file' => $model->file, 'methods' => $model->methods];
         } else {
             $s = Yii::app()->session['FormBuilder_' . $originalClass];
             $model->sourceFile = $s['sourceFile'];
             $model->file = $s['file'];
             $model->methods = $s['methods'];
             if (isset($s['timestamp'])) {
                 $model->timestamp = $s['timestamp'];
             }
         }
     }
     return $model;
 }
开发者ID:balitax,项目名称:plansys,代码行数:72,代码来源:FormBuilder.php

示例7: getPlansysDirName

 public static function getPlansysDirName()
 {
     return Helper::explodeLast(DIRECTORY_SEPARATOR, Yii::getPathOfAlias('application'));
 }
开发者ID:balitax,项目名称:plansys,代码行数:4,代码来源:Setting.php

示例8: actionPreviewSQL

 public function actionPreviewSQL()
 {
     $postdata = file_get_contents("php://input");
     $post = json_decode($postdata, true);
     $criteria = @$post['criteria'] ? $post['criteria'] : [];
     $params = @$post['params'] ? $post['params'] : [];
     $baseClass = $post['baseclass'];
     switch ($baseClass) {
         case "DataGrid":
         case "DataFilter":
         case "RelationField":
         case "TextField":
             $rel = 'currentModel';
             $name = $post['rfname'];
             $classPath = $post['rfclass'];
             $modelClassPath = $post['rfmodel'];
             $modelClass = Helper::explodeLast(".", $modelClassPath);
             Yii::import($modelClassPath);
             $class = Helper::explodeLast(".", $classPath);
             Yii::import($classPath);
             $model = new $modelClass();
             $builder = $model->commandBuilder;
             $fb = FormBuilder::load($classPath);
             $field = $fb->findField(['name' => $name]);
             $rf = new RelationField();
             $rf->builder = $fb;
             $rf->attributes = $field;
             $rf->relationCriteria = $criteria;
             $rf->params = $post['params'];
             $criteria = $rf->generateCriteria('', []);
             $criteria = new CDbCriteria($criteria);
             break;
         case "DataSource":
             $rel = $post['rel'];
             $name = $post['dsname'];
             $classPath = $post['dsclass'];
             $class = Helper::explodeLast(".", $classPath);
             Yii::import($classPath);
             $model = new $class();
             $builder = $model->commandBuilder;
             $fb = FormBuilder::load($classPath);
             $fb->model = new $model();
             $field = $fb->findField(['name' => $name]);
             $ds = new DataSource();
             $ds->attributes = $field;
             $criteria = DataSource::generateCriteria($params, $criteria, $ds);
             $criteria = SqlCriteria::convertPagingCriteria($criteria);
             $criteria = new CDbCriteria($criteria);
             break;
     }
     if (!isset($rel)) {
         echo json_encode(["sql" => '', "error" => '']);
         return false;
     }
     $isRelated = false;
     if ($rel == 'currentModel') {
         $tableSchema = $model->tableSchema;
     } else {
         $parent = $model::model()->find();
         $relMeta = $model->getMetadata()->relations[$rel];
         $relClass = $relMeta->className;
         if (!is_subclass_of($relClass, 'ActiveRecord')) {
             throw new CException("Class {$relClass} harus merupakan subclass dari ActiveRecord");
         }
         $tableSchema = $relClass::model()->tableSchema;
         if (!is_null($parent)) {
             $parentPrimaryKey = $parent->metadata->tableSchema->primaryKey;
             switch (get_class($relMeta)) {
                 case 'CHasOneRelation':
                 case 'CBelongsToRelation':
                     if (is_string($relMeta->foreignKey)) {
                         $criteria->addColumnCondition([$relMeta->foreignKey => $parent->{$parentPrimaryKey}]);
                         $isRelated = true;
                     }
                     break;
                 case 'CManyManyRelation':
                     $parser = new PhpParser\Parser(new PhpParser\Lexer\Emulative());
                     $stmts = $parser->parse('<?php ' . $relMeta->foreignKey . ';');
                     $bridgeTable = $stmts[0]->name->parts[0];
                     $arg0 = $stmts[0]->args[0]->value->name->parts[0];
                     $arg1 = $stmts[0]->args[1]->value->name->parts[0];
                     $criteria->join .= " " . $relMeta->joinType . " {$bridgeTable} ON t.{$tableSchema->primaryKey} = {$bridgeTable}.{$arg1} ";
                     break;
                 case 'CHasManyRelation':
                     //without through
                     if (is_string($relMeta->foreignKey)) {
                         $criteria->addColumnCondition([$relMeta->foreignKey => $parent->{$parentPrimaryKey}]);
                         $isRelated = true;
                     }
                     //with through
                     //todo..
                     break;
             }
         }
     }
     $command = $builder->createFindCommand($tableSchema, $criteria);
     $commandText = $command->text;
     if ($isRelated) {
         $commandText = str_replace(":ycp0", "\n" . '"{$model->' . $relMeta->foreignKey . '}"', $commandText);
     }
//.........这里部分代码省略.........
开发者ID:balitax,项目名称:plansys,代码行数:101,代码来源:SqlCriteria.php

示例9: renderAllToolbar

 public function renderAllToolbar($formType)
 {
     FormField::$inEditor = false;
     $toolbarData = Yii::app()->cache->get('toolbarData');
     if (!$toolbarData) {
         $toolbarData = FormField::allSorted();
         Yii::app()->cache->set('toolbarData', $toolbarData, 0);
     }
     foreach ($toolbarData as $k => $f) {
         $ff = new $f['type']();
         $scripts = array_merge($ff->renderScript(), $ff->renderEditorScript());
         foreach ($scripts as $script) {
             $ext = Helper::explodeLast(".", $script);
             if ($ext == "js") {
                 Yii::app()->clientScript->registerScriptFile($script, CClientScript::POS_END);
             } else {
                 if ($ext == "css") {
                     Yii::app()->clientScript->registerCSSFile($script);
                 }
             }
         }
     }
     FormField::$inEditor = true;
     return array('data' => $toolbarData);
 }
开发者ID:balitax,项目名称:plansys,代码行数:25,代码来源:FormsController.php

示例10: prepareFormName

 public function prepareFormName($class, $module = null)
 {
     if (isset($module)) {
         if (is_string($module)) {
             $moduleList = Setting::getModules();
             if (isset($moduleList[$module])) {
                 $moduleAlias = $moduleList[$module]['class'];
                 $moduleClass = Helper::explodeLast(".", $moduleAlias);
                 Yii::import($moduleAlias);
                 if (@class_exists($moduleClass)) {
                     $module = new $moduleClass($module, null);
                 }
             }
         }
         if (!is_object($module)) {
             $module = null;
         }
     } else {
         if (!isset($module)) {
             if (isset($this->module)) {
                 $module = $this->module;
             }
         }
     }
     if (strpos($class, '.') > 0) {
         $className = Helper::explodeLast(".", $class);
         if (!class_exists($className, false)) {
             try {
                 Yii::import($class);
             } catch (CException $e) {
                 if ($module) {
                     $moduleAlias = Helper::getAlias($module->basePath);
                     Yii::import($moduleAlias . ".forms." . $class);
                 } else {
                     $reflection = new ReflectionClass($this);
                     $path = $reflection->getFileName();
                     if (strpos($path, Yii::getPathOfAlias('app')) === 0) {
                         Yii::import('app.forms.' . $class);
                     } else {
                         if (strpos($path, Yii::getPathOfAlias('application')) === 0) {
                             Yii::import('application.forms.' . $class);
                         }
                     }
                 }
             }
         }
         $class = $className;
     } else {
         if (isset($module)) {
             $module = $module->id;
             if (stripos($class, $module) !== 0) {
                 if (!@class_exists($class)) {
                     $class = ucfirst($module) . ucfirst($class);
                 }
             }
         }
     }
     return $class;
 }
开发者ID:rizabudi,项目名称:plansys,代码行数:59,代码来源:Controller.php

示例11: render

 /**
  * render
  * Fungsi ini untuk me-render field dan atributnya
  * @return mixed me-return sebuah field dan atribut checkboxlist dari hasil render
  */
 public function render()
 {
     $this->addClass('form-group form-group-sm flat', 'options');
     $this->addClass($this->layoutClass, 'options');
     $this->addClass($this->errorClass, 'options');
     $this->fieldOptions['ui-tree-node'] = '';
     $this->fieldOptions['ng-repeat'] = 'item in value';
     $this->fieldOptions['ng-init'] = 'initItem(value, $index)';
     $this->addClass('list-view-item', 'fieldOptions');
     Yii::import(FormBuilder::classPath($this->templateForm));
     $class = Helper::explodeLast(".", $this->templateForm);
     if (($this->fieldTemplate == 'form' || $this->fieldTemplate == 'datasource') && class_exists($class)) {
         $fb = FormBuilder::load($class);
         $model = new $class();
         if ($this->value == "") {
             $this->value = [];
         }
         $this->templateAttributes = $model->attributes;
         $fb->model = $model;
         $this->renderTemplateForm = $fb->render($model, ['wrapForm' => false]);
     } else {
         if ($this->fieldTemplate == 'default') {
             $field = new $this->singleView();
             $field->attributes = $this->singleViewOption;
             $field->renderID = $this->name . rand(0, 10000);
             $field->builder = $this->builder;
             $field->formProperties = $this->formProperties;
             $this->templateAttributes = ['val' => ''];
             $this->renderTemplateForm = $field->render();
         }
     }
     $this->setDefaultOption('ng-model', "model.{$this->originalName}", $this->options);
     $jspath = explode(".", FormBuilder::classPath($this->templateForm));
     array_pop($jspath);
     $jspath = implode(".", $jspath);
     $inlineJS = str_replace("/", DIRECTORY_SEPARATOR, trim($this->inlineJS, "/"));
     $inlineJS = Yii::getPathOfAlias($jspath) . DIRECTORY_SEPARATOR . $inlineJS;
     if (is_file($inlineJS)) {
         $inlineJS = file_get_contents($inlineJS);
     } else {
         $inlineJS = '';
     }
     return $this->renderInternal('template_render.php', ['inlineJS' => $inlineJS]);
 }
开发者ID:reggi49,项目名称:plansys,代码行数:49,代码来源:ListView.php

示例12: actionQuery

 public function actionQuery()
 {
     $postdata = file_get_contents("php://input");
     $post = CJSON::decode($postdata);
     $class = Helper::explodeLast(".", $post['class']);
     Yii::import($post['class']);
     $this->lastCount = @$post['lc'] > 0 ? @$post['lc'] : 0;
     if (class_exists($class)) {
         $fb = FormBuilder::load($class);
         $field = $fb->findField(['name' => $post['name']]);
         if ($field['fieldType'] != "php" && method_exists($class, 'model')) {
             if (!is_null(@$post['model_id'])) {
                 $fb->model = $class::model()->findByPk(@$post['model_id']);
             }
             if (is_null($fb->model)) {
                 $fb->model = new $class();
             }
         }
         $this->attributes = $field;
         $this->builder = $fb;
         $this->queryParams = is_array(@$post['params']) ? @$post['params'] : [];
         if (is_object($this->model) && isset($post['modelParams'])) {
             $this->model->attributes = $post['modelParams'];
         }
         $isGenerate = isset($post['generate']);
         if (is_string($this->params)) {
             $this->params = [];
         }
         if ($this->postData == 'No' || $this->relationTo == '' || $this->relationTo == '-- NONE --') {
             ## without relatedTo
             switch ($this->fieldType) {
                 case "sql":
                     $data = $this->query($this->params);
                     break;
                 case "phpsql":
                     $this->sql = $this->execute($this->params);
                     $data = $this->query($this->params);
                     break;
                 case "php":
                     $data = $this->execute($this->params);
                     break;
             }
         } else {
             ## with relatedTo
             $data = $this->getRelated($this->params, $isGenerate);
         }
         if (empty($data)) {
             echo "{}";
             die;
         }
         echo json_encode(['data' => $data['data'], 'count' => $data['debug']['count'], 'params' => $data['debug']['params'], 'debug' => $this->debugSql == 'Yes' ? $data['debug'] : []]);
     }
 }
开发者ID:alfhan,项目名称:plansys,代码行数:53,代码来源:DataSource.php

示例13: actionUpdate

 public function actionUpdate($id = null)
 {
     $content = '';
     $name = '';
     $command = '';
     $commandFull = '';
     $commandPrefix = '';
     $file = '';
     $period = '';
     $periodType = '';
     $cmd = [];
     if (isset($id)) {
         $cmd = Setting::get('process.' . $id);
         if (count($cmd) > 0) {
             $id = $id;
             $name = $cmd['name'];
             $commandFull = $cmd['command'];
             $tmp = explode(" ", $cmd['command']);
             $commandPrefix = array_shift($tmp);
             $command = implode(" ", $tmp);
             $period = $cmd['period'];
             $periodType = $cmd['periodType'];
             $file = $cmd['file'];
             $prefix = Helper::explodeFirst("-", Helper::camelToSnake(Helper::explodeLast(".", $file)));
             //$filePath = Yii::getPathOfAlias((count($path)>2 ? "application.modules.". $path[1] . ".commands." . $path[2]  : "application.commands.". $path[1])) . ".php";
             $filePath = Yii::getPathOfAlias($file) . ".php";
             $content = file_get_contents($filePath);
         } else {
             $this->redirect(['/dev/processManager/']);
         }
     } else {
         $this->redirect(['/dev/processManager/']);
     }
     if (isset($_POST['DevSettingsProcessManagerForm'])) {
         $cmd = $_POST['DevSettingsProcessManagerForm'];
         $id = $_POST['processSettingsId'];
         $prefix = $_POST['processCommandPrefix'];
         Setting::set("process." . $id . ".name", $cmd['processName']);
         Setting::set("process." . $id . ".command", $prefix . ' ' . $cmd['processCommand']);
         Setting::set("process." . $id . ".period", $cmd['processPeriod']);
         Setting::set("process." . $id . ".periodType", $cmd['processPeriodType']);
         Setting::set("process." . $id . ".periodCount", ProcessHelper::periodConverter($cmd['processPeriod'], $cmd['processPeriodType']));
         $this->redirect(['/dev/processManager/']);
     }
     Asset::registerJS('application.static.js.lib.ace');
     $this->renderForm('settings.DevSettingsProcessManagerForm', ['content' => $content, 'name' => $file, 'prefix' => $name, 'processName' => $name, 'processCommand' => $command, 'processCommandPrefix' => $commandPrefix, 'processCommandFull' => $commandFull, 'processSettingsId' => $id, 'periodType' => $periodType, 'period' => $period]);
 }
开发者ID:balitax,项目名称:plansys,代码行数:47,代码来源:ProcessManagerController.php

示例14: load

 public static function load($classpath, $options = null)
 {
     $mt = new MenuTree();
     $mt->title = @$options['title'];
     $mt->icon = @$options['icon'];
     $mt->options = @$options['options'];
     $mt->inlineJS = @$options['inlineJS'];
     $mt->sections = !is_array(@$options['sections']) ? [] : @$options['sections'];
     $mt->classpath = $classpath;
     $mt->class = Helper::explodeLast(".", $classpath);
     $mt->list = (include Yii::getPathOfAlias($classpath) . ".php");
     MenuTree::fillMenuItems($mt->list);
     return $mt;
 }
开发者ID:reggi49,项目名称:plansys,代码行数:14,代码来源:MenuTree.php


注:本文中的Helper::explodeLast方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。