⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 table.inc

📁 PHPLOB注释详细版 使用模板技术的好帮手 PHP最有用的东东了
💻 INC
📖 第 1 页 / 共 3 页
字号:
      {        if ($key == $val)        {          $val = $name;          $found = 1;          break;        }      }    }    printf("%s", $val);    $this->table_heading_cell_close($class);  }    #==========================================================================  # Function : table_heading_cell_open  #--------------------------------------------------------------------------  # Purpose  : Starts a header cell.  # Arguments: $class - [optional] Used for CSS control.  # Returns  : Nothing  # Comments : Low-level function for table_heading_cell()  # History  :   #==========================================================================  function table_heading_cell_open($class="")   {    printf("  <th%s>", $class?" class=$class":"");  }    #==========================================================================  # Function : table_heading_cell_close  #--------------------------------------------------------------------------  # Purpose  : Ends a header cell.  # Arguments: $class - [optional] Used for CSS control.  # Returns  : Nothing  # Comments : Low-level function for table_heading_cell()  # History  :   #==========================================================================  function table_heading_cell_close($class="")   {    printf("</th>\n");  }    #==========================================================================  # Function : table_checkbox_cell  #--------------------------------------------------------------------------  # Purpose  : Outputs HTML code to display a checkbox. This function runs  #            if the member variable $check has been set. $check should be  #            set to some key within the $data array (ex: if $data["myKey"],  #            then set $check="myKey").  # Arguments: $row     - The row currently being written.  #            $row_key - If $data[$this-check] is empty, then this variable  #                       is used instead.  #            $data    - An array of data information.  #            $class   - [optional] Used for CSS control.  # Returns  :  # Comments :   # History  :  #==========================================================================  function table_checkbox_cell($row, $row_key, $data, $class="")   {    if ($this->check)    {      printf("  <td%s><input type=\"checkbox\" name=\"%s[%s]\" value=\"%s\"></td>\n",        $class?" class=$class":"",        $this->check,        $row,        empty($data[$this->check])?$row_key:$data[$this->check]);    }  }  #==========================================================================  ## Utility functions (used to be in util.inc, but were used only here and  ## did create a lot of confusion on installation) -- KK  #==========================================================================  #==========================================================================  # Function : verify_array  #--------------------------------------------------------------------------  # Purpose  : Verifies an array  # Arguments: $ary   - The array to verify.  # Returns  : 1 on success, 0 on error.  # Comments :   # History  :   #==========================================================================  function verify_array($ary)  {    if (!is_array($ary))      return 0;        return 1;  }      #==========================================================================  # Function : verify_2d_array  #--------------------------------------------------------------------------  # Purpose  : Verifies a 2D array  # Arguments: $ary   - The array to verify.  # Returns  : 1 on success, 0 on error.  # Comments :   # History  : 990616 - Removed "$this->" from "verify_array". (JSG)  #==========================================================================  function verify_2d_array($ary)  {    if (!$this->verify_array($ary))      return 0;        reset($ary);    if (!is_array(current($ary)))      return 0;    reset($ary);        return 1;  }      #==========================================================================  # Function : verify_db  #--------------------------------------------------------------------------  # Purpose  : Verifies a database object for results.  # Arguments: $db   - The database object to verify.  # Returns  : 1 on success, 0 on error.  # Comments :   # History  :   #==========================================================================  function verify_db($db)  {    if (!isset($db) && !$db)      return 0;        if ($db->num_rows() > 0)      return 1;       return 0;  }  ## Debugging function that prints an array  ##   Recursive is_array found within array  function print_array($ary)  {    if (is_array($ary))    {      while(list($key, $val) = each($ary))      {        echo "&nbsp;&nbsp;$key = $val<br>\n";        if (is_array($val))          print_array($val);      }    }  }  #==========================================================================  ## Helper functions  #==========================================================================    #==========================================================================  # Function : select_colnames  #--------------------------------------------------------------------------  # Purpose  : Selects the column names that should be displayed in an HTML  #            table. This is based on the $fields variable, if set. If it  #            is not set, then all fields names are used. This is how you  #            filter displayed data.  # Arguments: $data - A array containing information about the column   #                    names. If $fields is not used, then this variable is  #                    used instead.  # Returns  : An array containing the column names.  # Comments :  # History  :  #==========================================================================  function select_colnames($data)   {    global $debug;        if ($debug)      printf("<p>select_colnames()<br>\n");    if (!is_array($this->fields) && is_array($data))     {      reset($data);      while(list($key, $val) = each($data))       {        if (ereg($this->filter, $key))          $this->fields[] = $key;      }    }     $d = $this->fields;    if ($debug)    {      print_array($d);      printf("select_colnames() return<br>");    }        return $d;  }  #==========================================================================  # Misc. functions  #==========================================================================  #--------------------------------------------------------------------------  ## The following functions provide a very basic rendering  ## of a HTML table with CSS class tags. Table is useable  ## with them or the functions can be overridden for a  ## more complex functionality.  #--------------------------------------------------------------------------  #--------------------------------------------------------------------------  ## Table open and close functions.  #--------------------------------------------------------------------------  #==========================================================================  # Function : table_open  #--------------------------------------------------------------------------  # Purpose  : Outputs HTML code to open a table.  # Arguments: $class - [optional] Used for CSS control.  # Returns  : Nothing  # Comments :  # History  :  #==========================================================================  function table_open($class="")  {    global $debug;        if ($debug)      printf("<p>table_open()<br>\n");          printf("<table%s>\n", $class?" class=$class":"");  }  #==========================================================================  # Function : table_close  #--------------------------------------------------------------------------  # Purpose  : Outputs HTML code to close a table.  # Arguments: $class - [optional] Used for CSS control.  # Returns  : Nothing  # Comments : $class is not used by this function, but is available for  #            derived classes that override this function.  # History  :  #==========================================================================  function table_close($class="")   {    global $debug;        if ($debug)      printf("<p>table_close()<br>\n");          printf("</table>\n");  }  ## Row open and close functions.  #==========================================================================  # Function : table_row_open  #--------------------------------------------------------------------------  # Purpose  : Outputs HTML code to open a table row.  # Arguments: $row -   This variable is for derived classes that override   #                     this function that want access to the row number for   #                     the row about to be opened.  #            $data -  This variable is for derived classes that override   #                     this function that want access to the row data for   #                     the row about to be opened.  #            $class - [optional] Used for CSS control.  # Returns  :  # Comments :  # History  :  #==========================================================================  function table_row_open($row, $data, $class="")   {    printf(" <tr%s>\n", $class?" class=$class":"");  }  #==========================================================================  # Function : table_row_close  #--------------------------------------------------------------------------  # Purpose  : Outputs HTML code to close a table row.  # Arguments: $row -     This variable is for derived classes that override   #                       this function that want access to the row number   #                       for the row about to be closed.  #            $class   - [optional] Used for CSS control.  # Returns  :  # Comments : $class is not used by this function, but is available for  #            derived classes that override this function.  # History  :  #==========================================================================  function table_row_close($row, $class="")   {    printf(" </tr>\n");  }  #==========================================================================  ## Function overrides  #==========================================================================      #==========================================================================  # Function : table_heading_row_add_extra  #--------------------------------------------------------------------------  # Purpose  : Virtual function for derived classes. This function is called   #            after all header cells have been created. It allows the   #            programmer to add additional HTML code to the header row   #            before it is closed.  # Arguments: $data  #            $class   - [optional] Used for CSS control.  # Returns  :  # Comments :  # History  :  #==========================================================================  function table_heading_row_add_extra($data, $class="")  {}  #==========================================================================  # Function : table_row_add_extra  #--------------------------------------------------------------------------  # Purpose  : Virtual function for derived classes. This function is called   #            after all cells have been created. It allows the programmer to   #            add additional HTML code to the row before it is closed.  # Arguments: $row  #            $row_key  #            $data  #            $class   - [optional] Used for CSS control.  # Returns  :   # Comments :  # History  :  #==========================================================================  function table_row_add_extra($row, $row_key, $data, $class="")  {}}?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -