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


PHP HTML_QuickForm::exportValues方法代码示例

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


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

示例1: body

 public function body()
 {
     ob_start();
     //create default module form
     print '<div class="title">Select modules to disable</div>';
     print 'Selected modules will be marked as not installed but uninstall methods will not be called. Any database tables and other modifications made by modules\' install methods will not be reverted.<br><br>';
     print 'To uninstall module please use Modules Administration in Application.';
     print '<hr/><br/>';
     $form = new HTML_QuickForm('modulesform', 'post', $_SERVER['PHP_SELF'] . '?' . http_build_query($_GET), '', null, true);
     $states = array(ModuleManager::MODULE_ENABLED => 'Active', ModuleManager::MODULE_DISABLED => 'Inactive');
     $modules = DB::GetAssoc('SELECT * FROM modules ORDER BY state, name');
     foreach ($modules as $m) {
         $name = $m['name'];
         $state = isset($m['state']) ? $m['state'] : ModuleManager::MODULE_ENABLED;
         if ($state == ModuleManager::MODULE_NOT_FOUND) {
             $state = ModuleManager::MODULE_DISABLED;
         }
         $form->addElement('select', $name, $name, $states);
         $form->setDefaults(array($name => $state));
     }
     $form->addElement('button', 'submit_button', 'Save', array('class' => 'button', 'onclick' => 'if(confirm("Are you sure?")) document.modulesform.submit();'));
     //validation or display
     if ($form->validate()) {
         //uninstall
         $vals = $form->exportValues();
         foreach ($vals as $k => $v) {
             if (isset($modules[$k]['state']) && $modules[$k]['state'] != $v) {
                 ModuleManager::set_module_state($k, $v);
             }
         }
     }
     $form->display();
     return ob_get_clean();
 }
开发者ID:cretzu89,项目名称:EPESI,代码行数:34,代码来源:Modules.php

示例2: __construct

 public function __construct()
 {
     parent::__construct('delete_interest', 'Delete Interest', 'Admin/delete_interest.php');
     if ($this->loginError) {
         return;
     }
     $form = new HTML_QuickForm('deleter');
     $interest_list = new pdAuthInterests($this->db);
     $form->addElement('select', 'interests', 'Select interest(s) to delete:', $interest_list->list, array('multiple' => 'multiple', 'size' => 15));
     $form->addGroup(array(HTML_QuickForm::createElement('button', 'cancel', 'Cancel', array('onclick' => 'history.back()')), HTML_QuickForm::createElement('submit', 'submit', 'Delete')), null, null, '&nbsp;', false);
     if ($form->validate()) {
         $values = $form->exportValues();
         foreach ($values['interests'] as $interest_id) {
             $names[] = $interest_list->list[$interest_id];
         }
         $interest_list->dbDelete($this->db, $values['interests']);
         echo 'You have successfully removed the following interest from the ', 'database: <br/><b>', implode(', ', $names), '</b></p>', '<br><a href="', $_SERVER['PHP_SELF'], '">Delete another interest</a>';
     } else {
         $renderer =& $form->defaultRenderer();
         $form->accept($renderer);
         $this->form =& $form;
         $this->renderer =& $renderer;
         echo '<h3>Delete Interest </h3>';
     }
 }
开发者ID:papersdb,项目名称:papersdb,代码行数:25,代码来源:delete_interest.php

示例3: __construct

 public function __construct()
 {
     parent::__construct('view_publication', 'View Publication', 'view_publication.php');
     if ($this->loginError) {
         return;
     }
     $this->loadHttpVars();
     if (!isset($this->pub_id) || !is_numeric($this->pub_id)) {
         $this->pageError = true;
         return;
     }
     $pub = new pdPublication();
     $result = $pub->dbLoad($this->db, $this->pub_id);
     if (!$result) {
         echo 'Publication does not exist';
         return;
     }
     if (isset($this->submit_pending) && $this->submit_pending) {
         // check if this pub entry is pending
         $q = $this->db->selectRow('pub_pending', '*', array('pub_id' => $this->pub_id));
         assert('$q');
         $form = new HTML_QuickForm('submit_pending');
         $form->addElement('hidden', 'submit_pending', true);
         $form->addElement('hidden', 'pub_id', $this->pub_id);
         $elements = array();
         $elements[] = HTML_QuickForm::createElement('advcheckbox', 'valid', null, 'Valid', null, array(0, 1));
         $elements[] = HTML_QuickForm::createElement('submit', 'submit', 'Submit');
         $form->addGroup($elements, 'elgroup', '', '&nbsp', false);
         // create a new renderer because $form->defaultRenderer() creates
         // a single copy
         $renderer = new HTML_QuickForm_Renderer_Default();
         $form->accept($renderer);
         if ($form->validate()) {
             $values =& $form->exportValues();
             $pub->markValid($this->db);
             echo 'Publication entry marked as valid.';
             return;
         } else {
             echo "<h2>This publication entry requires validation</h2>\n";
             echo $renderer->toHtml();
         }
     }
     $this->showPublication($pub);
 }
开发者ID:papersdb,项目名称:papersdb,代码行数:44,代码来源:view_publication.php

示例4: EfrontSaml

#cpp#endif
if (isset($_GET['ctg']) && $_GET['ctg'] == 'saml') {
    $saml = new EfrontSaml();
    $saml->authenticate();
}
/* -----------------End of Login part-----------------------------*/
if (isset($_GET['ctg']) && $_GET['ctg'] == 'agreement' && $_SESSION['s_login']) {
    //Display license agreement
    try {
        $_SESSION['s_index_comply'] = 'agreement';
        $user = EfrontUserFactory::factory($_SESSION['s_login']);
        $agreementForm = new HTML_QuickForm("agreement_form", "post", basename($_SERVER['PHP_SELF']) . "?ctg=agreement", "", "class = 'indexForm'", true);
        $agreementForm->addElement('submit', 'submit_decline', _NOTACCEPTANDEXIT, 'class = "flatButton"');
        $agreementForm->addElement('submit', 'submit_accept', _ACCEPTANDCONTINUE, 'class = "flatButton"');
        if ($agreementForm->isSubmitted() && $agreementForm->validate()) {
            $values = $agreementForm->exportValues();
            if ($values['submit_accept']) {
                $user->user['viewed_license'] = 1;
                $user->persist();
                unset($_SESSION['s_index_comply']);
                EfrontEvent::triggerEvent(array("type" => EfrontEvent::SYSTEM_VISITED, "users_LOGIN" => $user->user['login'], "users_name" => $user->user['name'], "users_surname" => $user->user['surname']));
                if ($_SESSION['login_mode']) {
                    eF_redirect("index.php?ctg=checkout&checkout=1");
                }
                loginRedirect($user->user['user_type']);
            } else {
                $user->logout(session_id());
                eF_redirect("index.php");
            }
        }
        $renderer = new HTML_QuickForm_Renderer_ArraySmarty($smarty);
开发者ID:bqq1986,项目名称:efront,代码行数:31,代码来源:index.php

示例5: doCategoryReports

 private function doCategoryReports()
 {
     $smarty = $this->getSmartyVar();
     $currentUser = $this->getCurrentUser();
     $directionsTree = new EfrontDirectionsTree();
     $directionPaths = $directionsTree->toPathString();
     $form = new HTML_QuickForm("category_form", "post", basename($_SERVER['PHP_SELF']) . "?ctg=module&op=module_administrator_tools&tab=category_reports&do=enterprise", "", null, true);
     $form->addElement('select', 'category', _CATEGORY, $directionPaths);
     $form->addElement('checkbox', 'incomplete', _MODULE_ADMINISTRATOR_TOOLS_SHOWINCOMPLETE);
     $form->addElement('checkbox', 'inactive', _MODULE_ADMINISTRATOR_TOOLS_SHOWINACTIVECOURSES);
     $form->addElement('date', 'from_timestamp', _MODULE_ADMINISTRATOR_TOOLS_COMPLETEDFROM, array('minYear' => 1970, 'maxYear' => date("Y")));
     $form->addElement('date', 'to_timestamp', _MODULE_ADMINISTRATOR_TOOLS_COMPLETEDTO, array('minYear' => 1970, 'maxYear' => date("Y")));
     $form->addElement("submit", "submit", _SUBMIT, 'class = "flatButton"');
     $form->setDefaults(array("from_timestamp" => mktime(0, 0, 0, date("m") - 1, date("d"), date("Y")), "to_timestamp" => time()));
     if ($form->isSubmitted() && $form->validate()) {
         $values = $form->exportValues();
         $_SESSION['from_timestamp'] = mktime(0, 0, 0, $_POST['from_timestamp']['M'], $_POST['from_timestamp']['d'], $_POST['from_timestamp']['Y']);
         $_SESSION['to_timestamp'] = mktime(23, 59, 59, $_POST['to_timestamp']['M'], $_POST['to_timestamp']['d'], $_POST['to_timestamp']['Y']);
         $_SESSION['category'] = $values['category'];
         $_SESSION['incomplete'] = $values['incomplete'];
         $_SESSION['inactive'] = $values['inactive'];
         $smarty->assign("T_SHOW_TABLE", true);
     }
     if (isset($_GET['ajax']) && $_GET['ajax'] == 'categoryUsersTable' || $_GET['ajax'] == 'xls' || $_GET['ajax'] == 'show_xls') {
         $smarty->assign("T_SHOW_TABLE", true);
         $smarty->assign("T_DIRECTIONS_TREE", $directionPaths);
         $branchesTree = new EfrontBranchesTree();
         $branchesPaths = $branchesTree->toPathString();
         $category = new EfrontDirection($_SESSION['category']);
         $directionsTree = new EfrontDirectionsTree();
         $children = $directionsTree->getNodeChildren($_SESSION['category']);
         foreach (new EfrontAttributeFilterIterator(new RecursiveIteratorIterator(new RecursiveArrayIterator($children)), array('id')) as $value) {
             $siblings[] = $value;
         }
         $result = eF_getTableDataFlat("courses", "id", "archive = 0 && directions_ID in (" . implode(",", $siblings) . ")");
         $categoryCourses = $result['id'];
         $resultCourses = eF_getTableDataFlat("users_to_courses uc, courses c", "distinct c.id", 'c.id=uc.courses_ID ' . (!$_SESSION['inactive'] ? 'and c.active=1' : '') . ' and uc.archive=0 and uc.completed=1 and uc.to_timestamp >= ' . $_SESSION['from_timestamp'] . ' and uc.to_timestamp <= ' . $_SESSION['to_timestamp']);
         $resultEvents = eF_getTableDataFlat("events e, courses c", "distinct c.id", 'c.id=e.lessons_ID ' . (!$_SESSION['inactive'] ? 'and c.active=1' : '') . ' and e.type=54 and e.timestamp >= ' . $_SESSION['from_timestamp'] . ' and e.timestamp <= ' . $_SESSION['to_timestamp']);
         if (empty($resultEvents)) {
             $resultEvents['id'] = array();
         }
         $result = array_unique(array_merge($resultCourses['id'], $resultEvents['id']));
         $categoryCourses = array_intersect(array_unique($categoryCourses), $result);
         //count only courses that have users completed them
         if ($_SESSION['incomplete']) {
             $constraints = array('archive' => false, 'condition' => '(to_timestamp is null OR to_timestamp = 0 OR (to_timestamp >= ' . $_SESSION['from_timestamp'] . ' and to_timestamp <= ' . $_SESSION['to_timestamp'] . '))');
         } else {
             $constraints = array('archive' => false, 'condition' => 'completed=1 and to_timestamp >= ' . $_SESSION['from_timestamp'] . ' and to_timestamp <= ' . $_SESSION['to_timestamp']);
         }
         foreach ($categoryCourses as $courseId) {
             $course = new EfrontCourse($courseId);
             foreach ($course->getCourseUsers($constraints) as $value) {
                 $userBranches = $value->aspects['hcd']->getBranches();
                 $userSupervisors = $value->aspects['hcd']->getSupervisors();
                 $userSupervisor = end($userSupervisors);
                 $value->user['course_active'] = $course->course['active'];
                 $value->user['course_id'] = $course->course['id'];
                 $value->user['category'] = $directionPaths[$course->course['directions_ID']];
                 $value->user['course'] = $course->course['name'];
                 $value->user['directions_ID'] = $course->course['directions_ID'];
                 $value->user['branch'] = $branchesPaths[current($userBranches['employee'])];
                 $value->user['branch_ID'] = current($userBranches['employee']);
                 $value->user['supervisor'] = $userSupervisor;
                 $value->user['historic'] = false;
                 $unique = md5($value->user['to_timestamp'] . $value->user['course_id'] . $value->user['login']);
                 $courseUsers[$unique] = $value->user;
             }
             $result = eF_getTableData("events", "*", 'type=54 and lessons_ID=' . $courseId . ' and timestamp >= ' . $_SESSION['from_timestamp'] . ' and timestamp <= ' . $_SESSION['to_timestamp']);
             //exit;
             foreach ($result as $entry) {
                 try {
                     $value = EfrontUserFactory::factory($entry['users_LOGIN']);
                     if (!$value->user['archive']) {
                         $userBranches = $value->aspects['hcd']->getBranches();
                         $userSupervisors = $value->aspects['hcd']->getSupervisors();
                         //pr($entry['users_LOGIN']);pr($userSupervisors);pr(current($userSupervisors));
                         $userSupervisor = current($userSupervisors);
                         $value->user['course_active'] = $course->course['active'];
                         $value->user['course_id'] = $course->course['id'];
                         $value->user['category'] = $directionPaths[$course->course['directions_ID']];
                         $value->user['course'] = $course->course['name'];
                         $value->user['directions_ID'] = $course->course['directions_ID'];
                         $value->user['branch'] = $branchesPaths[current($userBranches['employee'])];
                         $value->user['branch_ID'] = current($userBranches['employee']);
                         $value->user['supervisor'] = $userSupervisor;
                         $value->user['to_timestamp'] = $entry['timestamp'];
                         $value->user['completed'] = 1;
                         $value->user['score'] = '';
                         $value->user['historic'] = true;
                         $unique = md5($value->user['to_timestamp'] . $value->user['course_id'] . $value->user['login']);
                         if (!isset($courseUsers[$unique])) {
                             $courseUsers[$unique] = $value->user;
                         }
                     }
                 } catch (Exception $e) {
                     /*Bypass non-existing users*/
                 }
             }
         }
         if ($_GET['ajax'] == 'xls') {
//.........这里部分代码省略.........
开发者ID:kaseya-university,项目名称:efront,代码行数:101,代码来源:module_administrator_tools.class.php

示例6: exportValues

 /**
  * Returns 'safe' elements' values
  *
  * @param   mixed   Array/string of element names, whose values we want. If not set then return all elements.
  * @param   bool    Whether to remove internal (_qf_...) values from the resultant array
  */
 function exportValues($elementList = null, $filterInternal = false)
 {
     $values = parent::exportValues($elementList);
     if ($filterInternal) {
         foreach (array_keys($values) as $key) {
             if (0 === strpos($key, '_qf_')) {
                 unset($values[$key]);
             }
         }
     }
     return $values;
 }
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:18,代码来源:Page.php

示例7: getModule

 /**
  * The main functionality
  *
  * (non-PHPdoc)
  * @see libraries/EfrontModule#getModule()
  */
 public function getModule()
 {
     $smarty = $this->getSmartyVar();
     $smarty->assign("T_MODULE_BASEDIR", $this->moduleBaseDir);
     $smarty->assign("T_MODULE_BASELINK", $this->moduleBaseLink);
     $smarty->assign("T_MODULE_BASEURL", $this->moduleBaseUrl);
     $dir = $this->moduleBaseDir . 'assets/';
     if (!is_dir($dir)) {
         mkdir($dir, 0755);
     }
     if ($_SESSION['s_type'] == 'administrator') {
         try {
             $form = new HTML_QuickForm("upload_files_form", "post", $this->moduleBaseUrl . '&tab=upload', "", null, true);
             $form->registerRule('checkParameter', 'callback', 'eF_checkParameter');
             //Register this rule for checking user input with our function, eF_checkParameter
             $form->addElement('file', 'file', _UPLOADFILE);
             if (G_VERSIONTYPE == 'enterprise') {
                 $tree = new EfrontBranchesTree();
                 $pathString = $tree->toPathString();
                 //$result = eF_getTableData("module_hcd_branch", "*", "url is not null and url !=''");
                 $handle = '<img id = "busy" src = "images/16x16/clock.png" style = "display:none;" alt = "{$smarty.const._LOADING}" title = "{$smarty.const._LOADING}"/><div id = "autocomplete_leaflet_branches" class = "autocomplete"></div>&nbsp;&nbsp;&nbsp;';
                 $form->addElement('static', 'sidenote', $handle);
                 $form->addElement('text', 'leaflet_branch_autoselect', _BRANCH, 'class = "autoCompleteTextBox" id = "autocomplete"');
                 $form->addElement('hidden', 'leaflet_branch', '', 'id = "leaflet_branch_value"');
             }
             $form->setMaxFileSize(FileSystemTree::getUploadMaxSize() * 1024);
             $form->addElement('submit', 'submit_upload', _UPLOAD, 'class = "flatButton"');
             if ($form->isSubmitted() && $form->validate()) {
                 $values = $form->exportValues();
                 try {
                     if ($values['leaflet_branch'] && eF_checkParameter($values['leaflet_branch'], 'id')) {
                         $branch = new EfrontBranch($values['leaflet_branch']);
                         if (!$branch->branch['url']) {
                             throw new Exception("You must assign a url to the selected branch to upload files for it");
                         }
                         $dir = $this->moduleBaseDir . 'assets/' . $branch->branch['url'];
                         mkdir($dir, 0755);
                     }
                     $filesystem = new FileSystemTree($dir);
                     $file = $filesystem->uploadFile("file", $dir);
                 } catch (Exception $e) {
                     $smarty->assign("T_EXCEPTION_TRACE", $e->getTraceAsString());
                     $message = $e->getMessage() . ' (' . $e->getCode() . ') &nbsp;<a href = "javascript:void(0)" onclick = "eF_js_showDivPopup(event, \'' . _ERRORDETAILS . '\', 2, \'error_details\')">' . _MOREINFO . '</a>';
                     $message_type = failure;
                     $this->setMessageVar($message, $message_type);
                 }
             }
             $smarty->assign('T_UPLOAD_FORM', $form->toArray());
             $url = $this->moduleBaseUrl;
             $basedir = $dir;
             $options = array('zip' => false, 'upload' => false, 'create_folder' => false, 'folders' => true);
             /**The file manager*/
             include "file_manager.php";
         } catch (Exception $e) {
             $smarty->assign("T_EXCEPTION_TRACE", $e->getTraceAsString());
             $message = $e->getMessage() . ' (' . $e->getCode() . ') &nbsp;<a href = "javascript:void(0)" onclick = "eF_js_showDivPopup(event, \'' . _ERRORDETAILS . '\', 2, \'error_details\')">' . _MOREINFO . '</a>';
             $message_type = 'failure';
             $this->setMessageVar($message, $message_type);
         }
     } else {
         if (defined('G_BRANCH_URL') && G_BRANCH_URL) {
             try {
                 $assets_path = $root_path = $this->moduleBaseDir . 'assets/' . G_BRANCH_URL;
             } catch (Exception $e) {
                 //do nothing here if the directory doesn't exist
             }
         } else {
             $assets_path = $root_path = $this->moduleBaseDir . 'assets/';
         }
         $files = array();
         if (!empty($_GET['folder'])) {
             $folder = urldecode($_GET['folder']);
             if (is_dir($assets_path . $folder)) {
                 $folder = new EfrontDirectory($assets_path . $folder);
                 if (strpos(realpath($folder['path']), $root_path) === false) {
                     throw new Exception("Invalid folder");
                 }
                 $parent_folder = dirname($folder['path']);
                 $url = urlencode(str_replace($root_path, '', $folder['path']));
                 $assets_path = $folder['path'];
                 $parent_url = $this->moduleBaseUrl . "&folder=" . urlencode(str_replace($root_path, '', dirname($folder['path']) . '/'));
                 $parent_url or $parent_url = $this->moduleBaseUrl . 'assets/';
                 $files[] = array('text' => '.. (Up one level)', 'image' => $this->moduleBaseLink . 'ico/folders.png', 'href' => $parent_url);
             }
         }
         //pr($url);pr($parent_url);
         //
         $filesystem = new FileSystemTree($assets_path, true);
         foreach ($filesystem->tree as $key => $value) {
             if ($value instanceof EfrontDirectory) {
                 $files[] = array('text' => basename($key), 'image' => $this->moduleBaseLink . 'ico/folders.png', 'href' => $this->moduleBaseUrl . "&folder=" . urlencode(str_replace($root_path, '', $value['path'] . '/')));
             }
         }
         foreach ($filesystem->tree as $key => $value) {
//.........这里部分代码省略.........
开发者ID:jiangjunt,项目名称:efront_open_source,代码行数:101,代码来源:module_info_kiosk.class.php

示例8: getModule

    /**
     * The main functionality
     *
     * (non-PHPdoc)
     * @see libraries/EfrontModule#getModule()
     */
    public function getModule()
    {
        $smarty = $this->getSmartyVar();
        $smarty->assign("T_MODULE_BASEDIR", $this->moduleBaseDir);
        $smarty->assign("T_MODULE_BASELINK", $this->moduleBaseLink);
        $smarty->assign("T_MODULE_BASEURL", $this->moduleBaseUrl);
        $form = new HTML_QuickForm("bootstrap_form", "post", $this->moduleBaseUrl, "", null, true);
        $form->registerRule('checkParameter', 'callback', 'eF_checkParameter');
        $form->addElement('text', 'name', _NAME, 'class = "inputText"');
        $form->addElement('static', '', _MODULE_BOOTSTRAP_WITHOUTTHECLASS, 'class = "inputText"');
        $form->addRule('name', _THEFIELD . ' ' . _NAME . ' ' . _ISMANDATORY, 'required', null, 'client');
        $form->addRule('name', _INVALIDFIELDDATA, 'checkParameter', 'alnum');
        $form->addElement('text', 'title', _TITLE, 'class = "inputText"');
        $form->addElement('text', 'creator', _MODULE_BOOTSTRAP_CREATOR, 'class = "inputText"');
        $form->addElement('checkbox', 'administrator', _ADMINISTRATOR);
        $form->addElement('checkbox', 'professor', _PROFESSOR);
        $form->addElement('checkbox', 'student', _STUDENT);
        $form->addElement('checkbox', 'supervisor', _MODULE_BOOTSTRAP_SUPERVISORONLY);
        $form->addElement('checkbox', 'tabber', _MODULE_BOOTSTRAP_TABBER);
        $form->addElement('textarea', 'form', _MODULE_BOOTSTRAP_FORMFIELDS, 'class = "inputTextarea" style = "height:40px"');
        $form->addElement('static', '', _MODULE_BOOTSTRAP_FORMINSTRUCTIONS);
        $form->addElement('textarea', 'grid', _MODULE_BOOTSTRAP_GRIDFIELDS, 'class = "inputTextarea" style = "height:40px"');
        $form->addElement('static', '', _MODULE_BOOTSTRAP_GRIDINSTRUCTIONS);
        $form->addElement('checkbox', 'filemanager', _MODULE_BOOTSTRAP_FILEMANAGER);
        $form->addElement('textarea', 'description', _DESCRIPTION, 'class = "inputTextarea" style = "height:80px"');
        //$form -> addElement('placing', 'student', _MODULE_BOOTSTRAP_NAME);
        $form->addElement('checkbox', 'overwrite', _MODULE_BOOTSTRAP_OVERWRITEIFEXISTS);
        $form->addElement('submit', 'submit', _INSTALL, 'class = "flatButton"');
        $form->setDefaults(array('creator' => $this->getCurrentUser()->user['name'] . ' ' . $this->getCurrentUser()->user['surname']));
        if ($form->isSubmitted() && $form->validate()) {
            try {
                $values = $form->exportValues();
                if (!$values['administrator'] && !$values['student'] && !$values['professor']) {
                    throw new Exception(_MODULE_BOOTSTRAP_YOUMUSTSELECTATLEASTATYPE);
                }
                $module_name = $values['name'];
                $module_dir = $this->moduleBaseDir . 'module_' . $module_name;
                if (!is_dir($module_dir)) {
                    mkdir($module_dir, 0755);
                }
                if (!is_dir("{$module_dir}/img")) {
                    mkdir("{$module_dir}/img", 0755);
                }
                if (!is_dir("{$module_dir}/assets")) {
                    mkdir("{$module_dir}/assets", 0755);
                }
                if ($values['administrator']) {
                    $roles[] = 'administrator';
                }
                if ($values['professor']) {
                    $roles[] = 'professor';
                }
                if ($values['student']) {
                    $roles[] = 'student';
                }
                $roles = '"' . implode('","', $roles) . '"';
                $contents = $tabber = $block = $grid_content = $fields_content = '';
                $fields = array();
                if ($values['form']) {
                    foreach (explode(",", $values['form']) as $property) {
                        $property = explode(":", $property);
                        array_walk($property, create_function('&$v', '$v = trim($v);'));
                        $fields[] = array('type' => $property[0], 'name' => $property[1], 'title' => $property[2], 'extra' => $property[3]);
                    }
                    foreach ($fields as $value) {
                        $fields_content .= '$form -> addElement("' . $value["type"] . '", "' . $value["name"] . '", "' . $value["title"] . '", "' . $value["extra"] . '");';
                    }
                } else {
                    $fields = "return false;";
                }
                if ($values['filemanager']) {
                    $file_manager = "true";
                } else {
                    $file_manager = "false";
                }
                if ($values['grid']) {
                    $headers = $rows = $grid_contents = array();
                    $grid_content = "\$data = array(array(";
                    foreach (explode(",", $values['grid']) as $property) {
                        $property = trim($property);
                        if ($property) {
                            $property = explode(":", $property);
                            array_walk($property, create_function('&$v', '$v = trim($v);'));
                            $headers[] = "\r\n\t\t\t\t\t\t\t\t<td class = 'topTitle' name = '{$property[0]}'>{$property[1]}</td>";
                            $rows[] = "\r\n\t\t\t\t\t\t\t\t<td>{\$item.{$property[0]}}</td>";
                            $grid_content .= "'{$property[0]}' => 'sample value',";
                        }
                    }
                    $grid_content .= "));";
                    $headers = implode("\n", $headers);
                    $rows = implode("\n", $rows);
                    $contents .= <<<GRID
{capture name = "t_grid_code"}
<!--ajax:{$module_name}Table-->
//.........这里部分代码省略.........
开发者ID:kaseya-university,项目名称:efront,代码行数:101,代码来源:module_bootstrap.class.php

示例9: getSmartyTpl


//.........这里部分代码省略.........
     }
     if (isset($_REQUEST['hide_right']) && $_REQUEST['hide_right'] == "1" && isset($_REQUEST['entry_body']) && $_REQUEST['entry_body'] != "" && isset($_REQUEST['edit']) && isset($_REQUEST['edit_entry'])) {
         if (isset($_SESSION['module_journal_hide_right_entry'])) {
             unset($_SESSION['module_journal_hide_right_entry']);
         }
         $_SESSION['module_journal_hide_right_entry'] = $_REQUEST['entry_body'];
     }
     if (isset($_REQUEST['hide_left']) && $_REQUEST['hide_left'] == "1" && isset($_REQUEST['entry_body']) && $_REQUEST['entry_body'] != "" && isset($_REQUEST['edit']) && isset($_REQUEST['edit_entry'])) {
         if (isset($_SESSION['module_journal_hide_left_entry'])) {
             unset($_SESSION['module_journal_hide_left_entry']);
         }
         $_SESSION['module_journal_hide_left_entry'] = $_REQUEST['entry_body'];
     }
     if (isset($_REQUEST['scroll_position']) && eF_checkParameter($_REQUEST['scroll_position'], 'id')) {
         $_SESSION['module_journal_scroll_position'] = $_REQUEST['scroll_position'];
     }
     if (isset($_GET['add_rule']) || isset($_GET['edit_rule']) && eF_checkParameter($_GET['edit_rule'], 'id') && in_array($_GET['edit_rule'], array_keys($rules))) {
         if ($_SESSION['s_type'] != "administrator") {
             eF_redirect($this->moduleBaseUrl . "&message=" . urlencode(_JOURNAL_NOACCESS));
         }
         isset($_GET['add_rule']) ? $postTarget = "&add_rule=1" : ($postTarget = "&edit_rule=" . $_GET['edit_rule']);
         global $load_editor;
         $load_editor = true;
         $form = new HTML_QuickForm("add_edit_rule_form", "post", $this->moduleBaseUrl . $postTarget, "", null, true);
         $form->addElement('text', 'title', _TITLE, 'class="inputText" style="width:498px;"');
         $form->addRule('title', _THEFIELD . ' "' . _TITLE . '" ' . _ISMANDATORY, 'required', null, 'client');
         $form->addElement('textarea', 'description', _DESCRIPTION, 'class="inputContentTextarea simpleEditor" style="width:500px;height:20em;"');
         $form->addElement('submit', 'submit', _SUBMIT, 'class="flatButton"');
         if (isset($_GET['edit_rule'])) {
             $editRule = $rules[$_GET['edit_rule']];
             $form->setDefaults($editRule);
         }
         if ($form->isSubmitted() && $form->validate()) {
             $values = $form->exportValues();
             $fields = array("title" => $values['title'], "description" => $values['description']);
             if ($values['description'] == '') {
                 $message = _JOURNAL_EMPTY_RULE_DESCRIPTION;
                 if (isset($_GET['add_rule'])) {
                     eF_redirect($this->moduleBaseUrl . "&message=" . $message . "&message_type=failure&add_rule=1");
                 } else {
                     eF_redirect($this->moduleBaseUrl . "&message=" . $message . "&message_type=failure&edit_rule=" . $_GET['edit_rule']);
                 }
             }
             if (isset($_GET['add_rule'])) {
                 if (eF_insertTableData("module_journal_rules", $fields)) {
                     $message = _JOURNAL_RULE_SUCCESSFULLY_ADDED;
                     eF_redirect($this->moduleBaseUrl . "&message=" . $message . "&message_type=success");
                 } else {
                     $message = _JOURNAL_RULE_ADD_PROBLEM;
                     eF_redirect($this->moduleBaseUrl . "&message=" . $message . "&message_type=failure");
                 }
             } else {
                 if (eF_updateTableData("module_journal_rules", $fields, "id=" . $_GET['edit_rule'])) {
                     $message = _JOURNAL_RULE_SUCCESSFULLY_EDITED;
                     eF_redirect($this->moduleBaseUrl . "&message=" . $message . "&message_type=success");
                 } else {
                     $message = _JOURNAL_RULE_EDIT_PROBLEM;
                     eF_redirect($this->moduleBaseUrl . "&message=" . $message . "&message_type=failure");
                 }
             }
         }
         $renderer = new HTML_QuickForm_Renderer_ArraySmarty($smarty);
         $form->setJsWarnings(_BEFOREJAVASCRIPTERROR, _AFTERJAVASCRIPTERROR);
         $form->setRequiredNote(_REQUIREDNOTE);
         $form->accept($renderer);
         $smarty->assign('T_JOURNAL_ADD_EDIT_RULE_FORM', $renderer->toArray());
开发者ID:bqq1986,项目名称:efront,代码行数:67,代码来源:module_journal.class.php

示例10: array

 //Register this rule for checking user input with our function, eF_checkParameter
 $createForm->addElement('text', 'english_name', _ENGLISHNAME, 'class = "inputText" id = "language_name"');
 $createForm->addElement('text', 'translation', _TRANSLATION, 'class = "inputText" id = "language_translation"');
 $createForm->addElement("advcheckbox", "rtl", _RTLLANGUAGE, null, 'class = "inputCheckBox" id = "language_rtl"', array(0, 1));
 $createForm->addElement("advcheckbox", "custom", _CUSTOMLANGUAGEFILE, null, 'class = "inputCheckBox" id = "custom_language"', array(0, 1));
 $createForm->addElement('file', 'language_upload', _FILENAME, 'class = "inputText"');
 $createForm->addElement('hidden', 'selected_language', null, 'id = "selected_language"');
 $createForm->addElement('submit', 'submit_upload_language', _SUBMIT, 'class = "flatButton"');
 $createForm->setMaxFileSize(FileSystemTree::getUploadMaxSize() * 1024);
 //getUploadMaxSize returns size in KB
 $createForm->addRule('english_name', _THEFIELD . ' "' . _ENGLISHNAME . '" ' . _ISMANDATORY, 'required', null, 'client');
 $createForm->addRule('english_name', _INVALIDFIELDDATA . ': ' . _ENGLISHNAME, 'checkParameter', 'file');
 $createForm->addRule('translation', _THEFIELD . ' "' . _TRANSLATION . '" ' . _ISMANDATORY, 'required', null, 'client');
 //$createForm -> addRule('language_upload', _THEFIELD.' "'._FILENAME.'" '._ISMANDATORY, 'required', null, 'client');
 if ($createForm->isSubmitted() && $createForm->validate()) {
     $values = $createForm->exportValues();
     try {
         if ($values['selected_language']) {
             if ($_FILES['language_upload']['error'] == 0) {
                 $filesystem = new FileSystemTree(G_ROOTPATH . 'libraries/language');
                 $uploadedFile = $filesystem->uploadFile('language_upload', G_ROOTPATH . 'libraries/language');
                 if ($values['custom']) {
                     $uploadedFile->rename(dirname($uploadedFile['path']) . '/custom-' . $values['english_name'] . '.php.inc', true);
                 } else {
                     $uploadedFile->rename(dirname($uploadedFile['path']) . '/lang-' . $values['english_name'] . '.php.inc', true);
                 }
             }
             $fields = array("name" => $values['english_name'], "translation" => $values['translation'], "rtl" => $values['rtl']);
             eF_updateTableData("languages", $fields, "name='" . $values['selected_language'] . "'");
             EfrontCache::getInstance()->deleteCache('languages');
             //include "editor/tiny_mce/langs/language.php";
开发者ID:jiangjunt,项目名称:efront_open_source,代码行数:31,代码来源:languages.php

示例11: mobile_rb_edit


//.........这里部分代码省略.........
                                                $n = array();
                                                foreach ($col_id as $cid) $n[] = $c[$cid];
                                                $n = implode(' ',$n);
                                            }
                                        }
                                        $comp[$k] = $n;
                                    }
                                }
                                if (!empty($multi_adv_params['order'])) natcasesort($comp);
                                foreach ($records as $k=>$v) {
                                    if (!empty($multi_adv_params['format_callback'])) $n = call_user_func($multi_adv_params['format_callback'], $v);
                                    else {
//                                      $n = $v[$col_id];
                                        if ($single_column) $n = $v[$col_id[0]];
                                        else {
                                            $n = array();
                                            foreach ($col_id as $cid) $n[] = $v[$cid];
                                            $n = implode(' ',$n);
                                        }
                                    }
                                    $comp[$k] = $n;
                                    unset($ext_rec[$v['id']]);
                                }
                                if (empty($multi_adv_params['order'])) natcasesort($comp);
                            }
                            if ($args['type']==='select') $comp = array(''=>'---')+$comp;
                            $qf->addElement($args['type'], $args['id'], $label, $comp, array('id'=>$args['id']));
                            if($id!==false)
                                $qf->setDefaults(array($args['id']=>$rec[$args['id']]));
                            break;
                case 'date':        $qf->addElement('date',$args['id'],$label,array('format'=>'d M Y', 'minYear'=>date('Y')-95,'maxYear'=>date('Y')+5, 'addEmptyOption'=>true, 'emptyOptionText'=>'--'));
                            if ($val)
                                $qf->setDefaults(array($args['id'] => $val));
                            break;
                case 'timestamp':   $qf->addElement('date',$args['id'],$label,array('format'=>'d M Y H:i', 'minYear'=>date('Y')-95,'maxYear'=>date('Y')+5, 'addEmptyOption'=>true, 'emptyOptionText'=>'--'));
                            if($val) {
                                $default = Base_RegionalSettingsCommon::time2reg($val, true, true, true, false);
                                $qf->setDefaults(array($args['id'] => $default));
                            }
                            break;
                case 'time':        $qf->addElement('date',$args['id'],$label,array('format'=>'H:i', 'addEmptyOption'=>true, 'emptyOptionText'=>'--'));
                            if($val) {
                                $default = Base_RegionalSettingsCommon::time2reg($val, true, true, true, false);
                                $qf->setDefaults(array($args['id'] => $default));
                            }
                            break;
                case 'multiselect': //ignore
                            if($id===false) continue;
                            $val = Utils_RecordBrowserCommon::get_val($tab,$field,$rec,true,$args);
                            if($val==='') continue;
                            $qf->addElement('static',$args['id'],$label);
                            $qf->setDefaults(array($args['id']=>$val));
                            unset($defaults[$args['id']]);
                            break;
            }
            if($args['required'])
                $qf->addRule($args['id'],__('Field required'),'required');
        }

        $qf->addElement('submit', 'submit_button', __('Save'),IPHONE?'class="button white"':'');

        if($qf->validate()) {
            $values = $qf->exportValues();
            foreach ($cols as $v) {
                if ($v['type']=='checkbox' && !isset($values[$v['id']])) $values[$v['id']]=0;
                elseif($v['type']=='date') {
                    if(is_array($values[$v['id']]) && $values[$v['id']]['Y']!=='' && $values[$v['id']]['M']!=='' && $values[$v['id']]['d']!=='')
                        $values[$v['id']] = sprintf("%d-%02d-%02d", $values[$v['id']]['Y'], $values[$v['id']]['M'], $values[$v['id']]['d']);
                    else
                        $values[$v['id']] = '';
                } elseif($v['type']=='timestamp') {
                    if($values[$v['id']]['Y']!=='' && $values[$v['id']]['M']!=='' && $values[$v['id']]['d']!=='' && $values[$v['id']]['H']!=='' && $values[$v['id']]['i']!=='') {
                        $timestamp = $values[$v['id']]['Y'] . '-' . $values[$v['id']]['M'] . '-' . $values[$v['id']]['d'] . ' ' . $values[$v['id']]['H'] . ':' . $values[$v['id']]['i'];
                        $values[$v['id']] = Base_RegionalSettingsCommon::reg2time($timestamp, true);
                    } else
                        $values[$v['id']] = '';
                } elseif($v['type']=='time') {
                    if($values[$v['id']]['H']!=='' && $values[$v['id']]['i']!=='') {
                        $time = recalculate_time(date('Y-m-d'), $values[$v['id']]);
                        $timestamp = Base_RegionalSettingsCommon::reg2time(date('1970-01-01 H:i:s', $time), true);
                        $values[$v['id']] = date('1970-01-01 H:i:s', $timestamp);
                    } else
                        $values[$v['id']] = '';
                }
            }
            foreach ($defaults as $k=>$v)
                if (!isset($values[$k])) $values[$k] = $v;
            if($id!==false) {
                $values['id'] = $id;
                Utils_RecordBrowserCommon::update_record($tab, $id, $values);
            } else {
                $id = Utils_RecordBrowserCommon::new_record($tab, $values);
            }
            return false;
        }

        $renderer =& $qf->defaultRenderer();
        $qf->accept($renderer);
        print($renderer->toHtml());
    }
开发者ID:62BRAINS,项目名称:EPESI,代码行数:101,代码来源:RecordBrowserCommon_0.php

示例12: unset

    //$modeForm -> addElement("select", "mode_social_events",  _EVENTSLOGGING, $modes);
    $modeForm->addElement("select", "mode_system_timeline", _SYSTEMTIMELINES, $modes);
    $modeForm->addElement("select", "mode_lessons_timeline", _LESSONTIMELINES, $modes);
    $modeForm->addElement("select", "mode_func_people", _PEOPLECONNECTIONS, $modes);
    $modeForm->addElement("select", "mode_func_comments", _COMMENTSWALL, $modes);
    $modeForm->addElement("select", "mode_func_userstatus", _USERSTATUS, $modes);
}
#cpp#endif
$modeForm->setDefaults($GLOBALS['configuration']);
if (isset($currentUser->coreAccess['configuration']) && $currentUser->coreAccess['configuration'] != 'change') {
    $modeForm->freeze();
} else {
    $modeForm->addElement("submit", "submit", _SAVE, 'class = "flatButton"');
    if ($modeForm->isSubmitted() && $modeForm->validate()) {
        //If the form is submitted and validated
        $values = $modeForm->exportValues();
        unset($values['submit']);
        foreach ($values as $key => $value) {
            EfrontConfiguration::setValue($key, $value);
        }
        //@TODO review by mixalis
        /*
        		$socialModulesToBeActivated = 
        		EfrontUser::isOptionVisible('system_timeline') &
        		EfrontUser::isOptionVisible('lessons_timeline') &
        		EfrontUser::isOptionVisible('func_people') &
        		EfrontUser::isOptionVisible('func_comments') &
        		EfrontUser::isOptionVisible('func_userstatus');
        vd($socialModulesToBeActivated);
        */
        //EfrontConfiguration :: setValue('social_modules_activated', $socialModulesToBeActivated);
开发者ID:jiangjunt,项目名称:efront_open_source,代码行数:31,代码来源:customization.php

示例13: where

} else {
    $checkbox->setChecked(false);
}
$sql_input_form->addElement('submit', 'execute_sql', 'Run Query');
if (isset($_SESSION['sql_select'])) {
    $sql_input_form->setDefaults(array('sql_select' => $_SESSION['sql_select'], 'sql_from' => $_SESSION['sql_from'], 'sql_where' => $_SESSION['sql_where'], 'sql_order' => $_SESSION['sql_order'], 'sql_order_dir' => $_SESSION['sql_order_dir'], 'sql_limit' => $_SESSION['sql_limit'], 'chart_period' => $_SESSION['chart_period']));
} else {
    $sql_input_form->setDefaults(array('sql_limit' => 10, 'sql_order_dir' => 'desc', 'chart_period' => 180));
}
if (isset($_POST['execute_sql'])) {
    if ($sql_input_form->validate()) {
        print '<table border="1" cellpadding="5" cellspacing="0" align="center"><tr><td align="center">';
        $sql_input_form->display();
        print '</td></tr>';
        // run the sql and return the results
        $data = $sql_input_form->exportValues();
        $_SESSION['sql_select'] = $sql_select = $data['sql_select'];
        $_SESSION['sql_from'] = $sql_from = $data['sql_from'];
        $_SESSION['sql_where'] = $sql_where = $data['sql_where'];
        $_SESSION['sql_order'] = $sql_order = $data['sql_order'];
        $_SESSION['sql_order_dir'] = $sql_order_dir = $data['sql_order_dir'];
        $_SESSION['sql_limit'] = $sql_limit = $data['sql_limit'];
        $_SESSION['chart_period'] = $chart_period = $data['chart_period'];
        $query = "select {$sql_select} from {$sql_from} where ({$sql_where}) and (quotes.date = '{$pf_working_date}' and quotes.exch = '{$pf_exch}') order by {$sql_order} {$sql_order_dir} limit {$sql_limit};";
        try {
            $pdo = new PDO("pgsql:host={$db_hostname};dbname={$db_database}", $db_user, $db_password);
            $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
        } catch (PDOException $e) {
            die("ERROR: Cannot connect: " . $e->getMessage());
        }
        print '<tr>';
开发者ID:kombat003,项目名称:trader-dss,代码行数:31,代码来源:select.php

示例14: getSmartyTpl


//.........这里部分代码省略.........
             }
         }
     }
     if (isset($_GET['delete_range']) && eF_checkParameter($_GET['delete_range'], 'id') && in_array($_GET['delete_range'], array_keys($ranges))) {
         try {
             eF_deleteTableData("module_gradebook_ranges", "id=" . $_GET['delete_range']);
         } catch (Exception $e) {
             handleAjaxExceptions($e);
         }
         exit;
     } else {
         if (isset($_GET['add_range']) || isset($_GET['edit_range']) && eF_checkParameter($_GET['edit_range'], 'id') && in_array($_GET['edit_range'], array_keys($ranges))) {
             $grades = array();
             for ($i = 0; $i <= 100; $i++) {
                 $grades[$i] = $i;
             }
             isset($_GET['add_range']) ? $postTarget = "&add_range=1" : ($postTarget = "&edit_range=" . $_GET['edit_range']);
             $form = new HTML_QuickForm("add_range_form", "post", $this->moduleBaseUrl . $postTarget, "", null, true);
             $form->registerRule('checkParameter', 'callback', 'eF_checkParameter');
             // XXX
             $form->addElement('select', 'range_from', _GRADEBOOK_RANGE_FROM, $grades);
             $form->addElement('select', 'range_to', _GRADEBOOK_RANGE_TO, $grades);
             $form->addElement('text', 'grade', _GRADEBOOK_GRADE, 'class = "inputText"');
             $form->addRule('grade', _THEFIELD . ' "' . _GRADEBOOK_GRADE . '" ' . _ISMANDATORY, 'required', null, 'client');
             $form->addRule('grade', _INVALIDFIELDDATA, 'checkParameter', 'text');
             // XXX
             $form->addElement('submit', 'submit', _SUBMIT, 'class = "flatButton"');
             if (isset($_GET['edit_range'])) {
                 $editRange = $ranges[$_GET['edit_range']];
                 $form->setDefaults($editRange);
             }
             if ($form->isSubmitted() && $form->validate()) {
                 $error = $invalid_range = false;
                 $values = $form->exportValues();
                 $fields = array("range_from" => $values['range_from'], "range_to" => $values['range_to'], "grade" => $values['grade']);
                 if (isset($_GET['edit_range'])) {
                     // do not check it below ...
                     unset($ranges[$_GET['edit_range']]);
                 }
                 foreach ($ranges as $range) {
                     if ($range['grade'] == $fields['grade']) {
                         $message = _GRADEBOOK_GRADE . " '" . $fields['grade'] . "' " . _GRADEBOOK_ALREADY_EXISTS;
                         $message_type = 'failure';
                         $error = true;
                         break;
                     }
                     if ($fields['range_from'] >= $range['range_from'] && $fields['range_to'] <= $range['range_to']) {
                         $invalid_range = true;
                     }
                     if ($fields['range_from'] >= $range['range_from'] && $fields['range_from'] < $range['range_to'] && $fields['range_to'] >= $range['range_to']) {
                         $invalid_range = true;
                     }
                     if ($fields['range_to'] > $range['range_from'] && $fields['range_to'] <= $range['range_to']) {
                         $invalid_range = true;
                     }
                     if ($fields['range_from'] <= $range['range_from'] && $fields['range_to'] >= $range['range_to']) {
                         $invalid_range = true;
                     }
                     if ($invalid_range) {
                         $message = _GRADEBOOK_INVALID_RANGE . ". " . _GRADEBOOK_RANGE;
                         $message .= " [" . $range['range_from'] . ", " . $range['range_to'] . "]" . " " . _GRADEBOOK_ALREADY_EXISTS;
                         $message_type = 'failure';
                         $error = true;
                         break;
                     }
                 }
开发者ID:kaseya-university,项目名称:efront,代码行数:67,代码来源:module_gradebook.class.php

示例15: array

$secondary[0][2] = 'Beck';
$secondary[1][3] = 'Noir Desir';
$secondary[1][4] = 'Violent Femmes';
$secondary[2][5] = 'Wagner';
$secondary[2][6] = 'Mozart';
$secondary[2][7] = 'Beethoven';
$select =& $form->addElement('hierselect', 'music', 'Please select:');
$select->setOptions(array($main, $secondary));
$form->addElement('textarea', 'message', 'Your message:', array('style' => 'width: 300px;', 'cols' => 50, 'rows' => '7'));
$form->addElement('submit', 'submit', 'Submit');
$form->addElement('hidden', 'hidden1', 'x');
$form->addElement('hidden', 'hidden2', 'y');
$form->addElement('hidden', 'hidden3', 'z');
$form->addRule('name', 'Please enter your name', 'required', null, 'client');
$form->addRule('email', 'Please enter your email address.', 'required', null, 'client');
$form->addRule('email', 'Please enter a valid email address.', 'email', null, 'client');
$form->addRule('subject', 'Please enter a subject.', 'required', null, 'client');
$form->addRule('message', 'Please enter a message.', 'required', null, 'client');
if ($form->isSubmitted() && $form->validate()) {
    $data = $form->exportValues();
    // do something with $data
    echo "<p>Thank you</p>\n";
} else {
    $renderer =& new HTML_QuickForm_Renderer_Tableless();
    $renderer->addStopFieldsetElements('submit');
    $form->accept($renderer);
    echo $renderer->toHtml();
}
?>
  </body>
</html>
开发者ID:swat30,项目名称:safeballot,代码行数:31,代码来源:contact.php


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