Exemplo n.º 1
0
function disListJson($count, $data, $model)
{
    $re['totalProperty'] = $count;
    $data_ary = array();
    foreach ($data as $val) {
        unset($tmp_ary);
        foreach ($model as $field) {
            $tmp_ary[$field['dataIndex']] = $val[$field['dataIndex']];
        }
        $data_ary[] = $tmp_ary;
    }
    $re['root'] = $data_ary;
    dis($re);
}
Exemplo n.º 2
0
 /**
  * Manage products.
  * 
  * @param  int    $projectID 
  * @access public
  * @return void
  */
 public function manageProducts($projectID)
 {
     /* use first project if projectID does not exist. */
     if (!isset($this->projects[$projectID])) {
         $projectID = key($this->projects);
     }
     $browseProjectLink = $this->createLink('project', 'browse', "projectID={$projectID}");
     if (!empty($_POST)) {
         $this->project->updateProducts($projectID);
         if (dao::isError()) {
             dis(js::error(dao::getError()));
         }
         die(js::locate($browseProjectLink));
     }
     $this->loadModel('product');
     $project = $this->project->getById($projectID);
     /* Set menu. */
     $this->project->setMenu($this->projects, $project->id);
     /* Title and position. */
     $title = $this->lang->project->manageProducts . $this->lang->colon . $project->name;
     $position[] = html::a($browseProjectLink, $project->name);
     $position[] = $this->lang->project->manageProducts;
     $allProducts = $this->product->getPairs('noclosed|nocode');
     $linkedProducts = $this->project->getProducts($project->id);
     // Merge allProducts and linkedProducts for closed product.
     $allProducts += $linkedProducts;
     $linkedProducts = join(',', array_keys($linkedProducts));
     /* Assign. */
     $this->view->title = $title;
     $this->view->position = $position;
     $this->view->allProducts = $allProducts;
     $this->view->linkedProducts = $linkedProducts;
     $this->display();
 }
 /**
  * Manage products.
  * 
  * @param  int    $projectID 
  * @access public
  * @return void
  */
 public function manageProducts($projectID)
 {
     $browseProjectLink = $this->createLink('project', 'browse', "projectID={$projectID}");
     if (!empty($_POST)) {
         $this->project->updateProducts($projectID);
         if (dao::isError()) {
             dis(js::error(dao::getError()));
         }
         die(js::locate($browseProjectLink));
     }
     $this->loadModel('product');
     $project = $this->project->getById($projectID);
     /* Set menu. */
     $this->project->setMenu($this->projects, $project->id);
     /* Title and position. */
     $header['title'] = $this->lang->project->manageProducts . $this->lang->colon . $project->name;
     $position[] = html::a($browseProjectLink, $project->name);
     $position[] = $this->lang->project->manageProducts;
     $allProducts = $this->product->getPairs();
     $linkedProducts = $this->project->getProducts($project->id);
     $linkedProducts = join(',', array_keys($linkedProducts));
     /* Assign. */
     $this->view->header = $header;
     $this->view->position = $position;
     $this->view->allProducts = $allProducts;
     $this->view->linkedProducts = $linkedProducts;
     $this->display();
 }
Exemplo n.º 4
0
include 'common.inc.php';
/*
 * 提交後的處理頁
 * 其中GET中的type為操作類型,可以讓command對應的command.type,即各個類型的單獨的處理文件中
 * GET中的action為操作,一般包括edit/delete等等
 * GET中的id為需要edit或者delete的記錄的ID
 */
$id = intval($_GET['id']);
$type = $_GET['type'];
$action = $_GET['action'];
if ($type) {
    if (class_exists($type) && in_array($action, array('info', 'add', 'edit', 'del', 'sysSet'))) {
        $class = new $type();
        switch ($action) {
            case 'info':
                dis($class->getInfo($id));
                exit;
                break;
            case 'add':
                if (isset($_POST['titlesub'])) {
                    $_POST['ntype'] = $_GET['ntype'];
                    $_POST['is_show'] = 1;
                    $id = $class->add($_POST);
                } else {
                    $id = $class->add($_POST);
                }
                echo "{id:" . intval($id) . ",ok:'yes'}";
                exit;
                break;
            case 'edit':
                if (isset($_POST['recommend'])) {
Exemplo n.º 5
0
<!DOCTYPE HTML PUBLIC"-//WSC//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>PHP基礎</title>
</head>
<boby>

<?php 
//課題2:引数として数値を受け取り、その値が奇数か偶数か判別&表示する処理
//を関数として制作し、適当な数値に対して奇数・偶数の判別を行ってください
$result = dis(1);
print "{$result}";
function dis($num)
{
    if ($num % 2 == 0) {
        //$numという引数(数字が入っている)ものへ、文字列を上書きするのはあまり良くない
        $moji = "偶数";
    } else {
        $moji = "奇数";
    }
    return $moji;
}
?>

</body>
</html>
Exemplo n.º 6
0
function dis($parent_id, $level, $index1, $data1)
{
    $parent_id = $parent_id === 0 ? '0' : $parent_id;
    if (isset($index1[$parent_id])) {
        foreach ($index1[$parent_id] as $id) {
            echo '<option value=' . $data1[$id]['rec_id'] . '>' . str_repeat('_', $level) . $data1[$id]['department_name'] . '</option>';
            dis($id, $level + 1, $index1, $data1);
        }
    }
}
                                            ?>
</td></tr>
<tr><td class=head><b>MySQL : </td><td><?php 
                                            echo function_exists('mysql_connect') ? "<b>Enable" : "Disable";
                                            ?>
</td></tr>
<tr><td class=head><b>MSSQL :</td><td><?php 
                                            echo function_exists('mssql_connect') ? "<b>Enable" : "Disable";
                                            ?>
</td></tr>
<tr><td class=head><b>PostgreSQL :</td><td><?php 
                                            echo function_exists('pg_connect') ? "<b>Enable" : "Disable";
                                            ?>
</td></tr>
<tr><td class=head><b>Disable functions :</td><td><?php 
                                            dis();
                                            ?>
</td></tr>
<tr><td class=head><b>Total Disk Space : </td><td><?php 
                                            echo disk(1);
                                            ?>
</td></tr>
<tr><td class=head><b>Free Space : </td><td><?php 
                                            echo disk(2);
                                            ?>
</td></tr>
<tr><td class=head><b>OS</td><td><?php 
                                            echo php_uname();
                                            ?>
</td></tr>
<tr><td class=head><b>Server Software : </td><td><?php 
Exemplo n.º 8
0
<!DOCTYPE HTML PUBLIC"-//WSC//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>PHP基礎</title>
</head>
<boby>

<?php 
//課題8:課題1、課題2のユーザー定義箇所を含んだutil.phpを作成し、
//requireで呼び出して表示する
require "util.php";
//自己紹介
my_profile();
print "<br>";
//奇数か偶数かの判別
$result = dis(101);
print "{$result}";
?>

</body>
</html>