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


PHP get_cell函数代码示例

本文整理汇总了PHP中get_cell函数的典型用法代码示例。如果您正苦于以下问题:PHP get_cell函数的具体用法?PHP get_cell怎么用?PHP get_cell使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: plugin_display_show

/**
 *  Extends function display_show
 *
 * modified to duplicatean entry for reordering
 */
function plugin_display_show($db, $Allfields, $id)
{
    global $PHP_SELF, $md, $USER, $tableinfo, $system_settings;
    $dbstring = $PHP_SELF;
    $dbstring .= "?";
    $dbstring .= "tablename=" . $tableinfo->name . "&";
    echo "<form name='order_form' method='post' id='protocolform' enctype='multipart/form-data' {$j2} action='{$dbstring}'>\n";
    echo "<input type='hidden' name='md' value='{$md}'>\n";
    echo "<table border=0 align='center'>\n";
    // initailize a blank array
    $Allfields2 = array();
    // Define variables to be cleared from the arrays
    $badnames = array('date_ordered', 'confirmed');
    // variables to not be messed with, rather these are explicitly defined later or system set*/
    $notouch = array('date', 'ordered_by', 'date_requested', 'ownerid', 'magic');
    foreach ($Allfields as $nowfield2) {
        $flag = 1;
        foreach ($badnames as $nolike) {
            if ($nowfield2[label] == $nolike) {
                $flag = 0;
            }
        }
        foreach ($notouch as $nolike2) {
            if ($nowfield2[label] == $nolike2) {
                $flag = 666;
            }
        }
        if ($flag == 1) {
            echo "<input type='hidden' name='{$nowfield2['name']}' value='{$nowfield2['values']}'>\n";
        } elseif ($flag == 0) {
            echo "<input type='hidden' name='{$nowfield2['name']}' value=''>\n";
        }
    }
    /* set the magic variable*/
    $magic = time();
    echo "<input type='hidden' name='magic' value='{$magic}'>\n";
    /* Put in the date requested, who requested it, etc*/
    $dateformat = get_cell($db, 'dateformats', 'dateformat', 'id', $system_settings['dateformat']);
    $date = time();
    $date = date($dateformat, $date);
    $date .= '-reorder';
    echo "<input type='hidden' name='date_requested' value='{$date}'>\n";
    $r = $db->Execute("SELECT firstname,lastname,email FROM users WHERE id={$USER}");
    $myname = $USER['firstname'] . ' ' . $USER['lastname'];
    echo "<input type='hidden' name='ordered_by' value='{$myname}'>\n";
    echo "<input type='hidden' name='subm' value=''>\n";
    echo "<td colspan=7 align='center'><input type='button' name='sub' value='Re-order' onClick='document.order_form.subm.value=\"Add Record\"; document.order_form.submit(); window.opener.document.g_form.search.value=\"Search\"; window.opener.document.g_form.submit(); window.opener.focus(); '>\n";
    //echo "<td colspan=7 align='center'><input type='button' name='sub' value='Re-order' onClick='document.order_form.subm.value=\"Add Record\"; document.order_form.submit(); window.opener.document.g_form.search.value=\"Search\"; setTimeout(\"window.opener.document.g_form.submit(); window.opener.focus(); window.close();\",300); '>\n";
    echo "&nbsp;&nbsp;<input type='button' name='sub' value='Cancel' onClick='window.opener.focus(); window.close();'></td>\n";
    //end of table
    echo "</tr>\n</table>\n</form>\n";
}
开发者ID:nicost,项目名称:phplabware,代码行数:57,代码来源:ordering_plugin.php

示例2: modify_group

/**
 *  Change that groupname.  
 *
 * On error, returns an error string
 */
function modify_group($db, $groupid, $new_name)
{
    // Only change the name when there is a new one provided
    if (!$new_name) {
        return "Please enter a groupname!";
    }
    // check whether a group with the new name already exists
    $r = $db->Execute("SELECT id FROM groups WHERE \n                   (name='{$new_name}' AND NOT id='{$groupid}');");
    if (!$r->EOF) {
        return "Groupname <b>{$new_name}</b> already exists, please select another name";
    } else {
        // get the old name
        $old_name = get_cell($db, "groups", "name", "id", $groupid);
        $query = "UPDATE groups SET name='{$new_name}' WHERE id='{$groupid}';";
        if ($db->Execute($query)) {
            echo "New groupname is <b>{$new_name}</b><br><br>";
        }
    }
}
开发者ID:nicost,项目名称:phplabware,代码行数:24,代码来源:groups.php

示例3: modify

/**
 *  Interacts with the SQL database to create/modify users
 *
 * can be called to create (type=create) or modify (type=modify) other users or oneselves (type=me) 
 */
function modify($db, $type)
{
    global $_POST, $USER, $perms, $perms2, $perms3, $post_vars;
    // quote all bad characters:
    foreach ($_POST as $key => $value) {
        if (!is_array($_POST[$key])) {
            $_POST[$key] = addslashes($value);
        }
    }
    $id = $_POST['id'];
    $login = $_POST['login'];
    $pwd = $_POST['pwd'];
    $user_group = $_POST['user_group'];
    $user_add_groups = $_POST['user_add_groups'];
    $firstname = $_POST['firstname'];
    $lastname = $_POST['lastname'];
    $email = $_POST['email'];
    $USER['settings']['style'] = $_POST['user_style'];
    if ($perms) {
        for ($i = 0; $i < sizeof($perms); $i++) {
            $permissions = $permissions | $perms[$i];
        }
    }
    if (!$permissions) {
        $permissions = 0;
    }
    if ($perms2) {
        for ($i = 0; $i < sizeof($perms2); $i++) {
            $permissions2 = $permissions2 | $perms2[$i];
        }
    }
    if (!$permissions2) {
        $permissions2 = 0;
    }
    if ($perms3) {
        for ($i = 0; $i < sizeof($perms3); $i++) {
            $permissions3 = $permissions3 | $perms3[$i];
        }
    }
    if (!$permissions3) {
        $permissions3 = 0;
    }
    // include here, to avoid being overwritten by post_vars
    include './includes/defines_inc.php';
    // check whether status of the victim is smaller than
    //  the current users status
    if ($type == 'modify') {
        $original_permissions = get_cell($db, 'users', 'permissions', 'id', $id);
    }
    // check whether this is not illegitimate
    if (!($USER['permissions'] & $SUPER || $USER['permissions'] & $ADMIN && $USER['groupid'] == $user_group && $USER['permissions'] > $original_permissions || $USER['id'] == $id)) {
        echo 'You are not allowed to do this. <br>';
        return false;
    }
    // log some info
    $theid = $USER['id'];
    $theip = getenv('REMOTE_ADDR');
    $thedate = time();
    if ($type == 'modify' && $id) {
        $query = "UPDATE users SET login='{$login}', firstname='{$firstname}', \n                     lastname='{$lastname}',  \n                     groupid='{$user_group}', email='{$email}',  \n                     permissions='{$permissions}', permissions2='{$permissions2}',\n                     modbyid='{$theid}',\n\t\t     modbyip='{$theip}', moddate='{$thedate}'";
        if ($pwd) {
            $pwd = md5($pwd);
            $query .= ", pwd='{$pwd}'";
        }
        $query .= " WHERE id='{$id}';";
        if ($db->Execute($query)) {
            echo "Modified settings of user <i>" . stripslashes($firstname) . ' ' . stripslashes($lastname) . "</i>.<br>\n";
            $db->Execute("DELETE FROM usersxgroups WHERE usersid={$id}");
            if ($user_add_groups) {
                foreach ($user_add_groups as $add_groupid) {
                    $db->Execute("INSERT INTO usersxgroups VALUES ('{$id}','{$add_groupid}')");
                }
            }
        } else {
            echo "Could not modify settings of user: <i>" . stripslashes($firstname) . ' ' . stripslashes($lastname) . "</i>.<br>\n";
        }
    } elseif ($type == 'create') {
        $id = $db->GenID('users_id_seq');
        $pwd = md5($pwd);
        $new_user_settings['menustyle'] = 1;
        $new_user_settings = serialize($new_user_settings);
        $query = "INSERT INTO users (id, login, pwd, groupid, firstname, lastname, permissions, permissions2, email, createdbyid, createdbyip, createddate, settings) ";
        $query .= "VALUES('{$id}','{$login}','{$pwd}','{$user_group}','{$firstname}','{$lastname}', '{$permissions}', '{$permissions2}','{$email}', '{$theid}', '{$theip}', '{$thedate}', '{$new_user_settings}')";
        if ($db->Execute($query)) {
            echo "User <i>{$firstname} {$lastname}</i> added.<br>\n";
            if ($user_add_groups) {
                foreach ($user_add_groups as $add_groupid) {
                    $db->Execute("INSERT INTO usersxgroups VALUES ('{$id}','{$add_groupid}')");
                }
            }
        } else {
            echo "Failed to add user: <i>{$firstname} {$lastname}</i>.<br>\n";
        }
    } elseif ($type == 'me' && $id) {
        $query = "UPDATE users SET firstname='{$firstname}', \n                     lastname='{$lastname}',  \n                     email='{$email}',\n\t\t     modbyid='{$theid}',\n\t\t     moddate='{$thedate}',\n\t\t     modbyip='{$theip}'";
//.........这里部分代码省略.........
开发者ID:nicost,项目名称:phplabware,代码行数:101,代码来源:users.php

示例4: mysql_query

   	<th>Batch UDT</th>
  
    

  </tr>
<?php 
$i = 1;
$query = "select * from `base` where `pincode_change_flag`=1";
$query = mysql_query($query);
if (mysql_num_rows($query) > 0) {
    while ($row = mysql_fetch_array($query)) {
        $id = $row['id'];
        $fes = $row['fe'];
        $pre_fes = $row['previous_fes'];
        $fes_contact_no = get_cell('fes', get_fes_id($fes), 'fes_mobile_no');
        $pre_fes_contact_no = get_cell('fes', get_fes_id($pre_fes), 'fes_mobile_no');
        ?>
		<tr>
		<td ><?php 
        echo $i++;
        ?>
</td>
        <td ><?php 
        echo $row['code'];
        ?>
</td>
		<td ><?php 
        echo $row['external_id'];
        ?>
</td>
        <td ><?php 
开发者ID:clusterwebsolutions,项目名称:airtel_agent,代码行数:31,代码来源:view_pincode_change_history.php

示例5: md5

 $pwd = md5($PHP_AUTH_PW);
 $db_query = "SELECT login FROM users WHERE login=? AND pwd=?";
 $db_result = $db->Execute($db_query, array($PHP_AUTH_USER, $pwd));
 if ($db_result) {
     $auth = $db_result->fields['login'];
 }
 // check that there is no one else like this
 $db_result->Movenext();
 if (!$db_result->EOF) {
     $auth = false;
 }
 // if pam_prg is present, check whether the user is known on the system
 $pam_prg = $system_settings['checkpwd'];
 if ($system_settings['authmethod'] == 2 && $pam_prg && !$auth) {
     // this only makes sense if the user has an account on this instance of phplabware
     if (get_cell($db, 'users', 'login', 'login', $PHP_AUTH_USER)) {
         $esc_user = escapeshellarg($PHP_AUTH_USER);
         $esc_pass = escapeshellarg($PHP_AUTH_PW);
         $test = exec("echo {$esc_pass} | {$pam_prg} {$esc_user}", $dummy, $result);
         if ($result) {
             // we are authenticated
             $auth = true;
             $authmethod = 'pam';
         }
     }
 }
 // if authenticated, this session is OK:
 if ($auth) {
     if ($_SESSION['javascript_enabled'] || ($_POST['javascript_enabled'] || $_GET['javascript_enabled'])) {
         $_SESSION['javascript_enabled'] = true;
     } else {
开发者ID:nicost,项目名称:phplabware,代码行数:31,代码来源:auth_inc.php

示例6: show_table_column_page

/**
 *   show page with choice of tables, dynamically generate list with columns
 *
 */
function show_table_column_page($db, $table_name, $addcol_name, $addcol_label)
{
    global $_GET;
    echo "<form method='post' id='table_type'>\n";
    echo "<input type='hidden' name='table_name' value='{$table_name}'></input>\n";
    echo "<input type='hidden' name='addcol_name' value='{$addcol_name}'></input>\n";
    echo "<input type='hidden' name='addcol_label' value='{$addcol_label}'></input>\n";
    // box 1 with tablenames
    $r = $db->Execute("SELECT tablename,id,table_desc_name FROM tableoftables WHERE permission='Users' AND tablename <> 'settings' AND tablename <> '{$table_name}'  AND table_desc_name IS NOT NULL ORDER BY sortkey");
    // box 2, dynamically filled with column names
    $the_array = "modelinfo = new Array (\n";
    $the_array .= make_column_js_array($db, $r);
    $r->MoveNext();
    while (!$r->EOF) {
        $the_array .= ",\n " . make_column_js_array($db, $r);
        $r->MoveNext();
    }
    $the_array .= "\n)\n";
    echo add_js($the_array);
    $jscript = "onChange=\"fillSelectFromArray(this.form.table_column_select,((this.selectedIndex == -1) ? null : modelinfo[this.selectedIndex-1]));\"";
    echo "<h3 align='center'>Choose Table and column to be associated with column <i>{$addcol_label}</i> in table <i>{$table_name}</i>.</h3>\n";
    echo "<table align='center' cellpadding='2' cellspacing='0'>\n";
    echo "<tr><th>Table</th>\n<th>Column</th><th>&nbsp;</th></tr>\n";
    $rm = $db->Execute("SELECT tablename,id FROM tableoftables WHERE permission='Users' AND tablename <> 'settings' AND tablename <> '{$table_name}'  AND table_desc_name IS NOT NULL ORDER BY sortkey");
    echo "<tr><td>" . $rm->GetMenu2("table_select", "", true, false, 0, $jscript) . "</td>\n";
    echo "<td><select name='table_column_select'></select></td>\n";
    echo "</tr>\n";
    $_GET['tablename'] = $table_name;
    $tableinfo = new tableinfo($db);
    $rs = $db->Execute("SELECT id,associated_table,associated_column,associated_local_key,label FROM {$tableinfo->desname} WHERE datatype='table'");
    if ($rs && !$rs->EOF) {
        echo "<tr><td colspan=3>Grouping:</td></tr>\n";
        echo "<tr><td colspan=3><input type='radio' name='ass_to'> Make this a primary key</input></td></tr>\n";
        while (!$rs->EOF) {
            if ($rs->fields['associated_table'] && !$rs->fields['associated_local_key']) {
                $ass_tableinfo = new tableinfo($db, false, $rs->fields['associated_table']);
                $ass_column = get_cell($db, $ass_tableinfo->desname, 'label', 'id', $rs->fields['associated_column']);
                echo "<tr><td colspan=3><input type='radio' name='ass_to' value='{$rs->fields[0]}'> Associate with: Local column: <i>{$rs->fields['label']}</i> (Foreign table: <i>{$ass_tableinfo->name}</i>, column: <i>{$ass_column}</i>),</input></td></tr>\n";
            }
            $rs->MoveNext();
        }
    }
    echo "<tr><td colspan=3 align='center'><input type='submit' name='submit' value='Submit'></input></td></tr>\n";
    echo "</table>\n</form>\n";
}
开发者ID:nicost,项目名称:phplabware,代码行数:49,代码来源:tablemanage_inc.php

示例7: mysql_query

	<th>Actions</th>
  </tr>
<?php 
$i = 1;
$query = mysql_query("select * from `userinfo` where 1");
if (mysql_num_rows($query) > 0) {
    while ($row = mysql_fetch_array($query)) {
        $id = $row['id'];
        ?>
		<tr>
		<td ><?php 
        echo $i++;
        ?>
</td>
        <td ><?php 
        echo get_cell('groups', $row['user_type'], 'name');
        ?>
</td>
		<td ><?php 
        echo $row['name'];
        ?>
</td>
        <td ><?php 
        echo $row['email'];
        ?>
</td>
		
		
        <td ><a href="javascript:;" onClick="edit_user('<?php 
        echo $row['id'];
        ?>
开发者ID:clusterwebsolutions,项目名称:airtel_agent,代码行数:31,代码来源:view_users.php

示例8: may_write

/**
 *  checks if this user may write/modify/delete these data
 *
 */
function may_write($db, $tableid, $id, $USER)
{
    include './includes/defines_inc.php';
    $table = get_cell($db, 'tableoftables', 'real_tablename', 'id', $tableid);
    if ($USER['permissions'] & $SUPER || $USER['permissions'] & $TABLECREATOR) {
        return true;
    }
    if ($USER['permissions'] & $WRITE && !$id) {
        return true;
    }
    $ownerid = get_cell($db, $table, 'ownerid', 'id', $id);
    $ownergroup = get_cell($db, 'users', 'groupid', 'id', $ownerid);
    if ($USER['permissions'] & $ADMIN) {
        if ($USER['groupid'] == $ownergroup) {
            return true;
        }
    }
    if ($USER['permissions'] & $WRITE && $id) {
        $userid = $USER['id'];
        // 'user' write access
        if ($r = $db->Execute("SELECT * FROM {$table} WHERE id={$id} AND\n            ownerid={$userid}")) {
            if (!$r->EOF) {
                return true;
            }
        }
        // 'group' write access
        if ($r = $db->Execute("SELECT * FROM {$table} WHERE id={$id} AND gw='1'")) {
            if (!$r->EOF && in_array($ownergroup, $USER['group_array'])) {
                return true;
            }
        }
        // 'world' write access
        if ($r = $db->Execute("SELECT * FROM {$table} WHERE id={$id} AND ew='1'")) {
            if (!$r->EOF) {
                return true;
            }
        }
        // 'and also' write access
        if ($r = $db->Execute("SELECT * FROM trust WHERE trusteduserid='{$userid}'\n              AND tableid='{$tableid}' AND recordid='{$id}' AND rw='w'")) {
            if (!$r->EOF) {
                return true;
            }
        }
    }
}
开发者ID:nicost,项目名称:phplabware,代码行数:49,代码来源:db_inc.php

示例9:

 if ($version < 0.2003) {
     // Adds column key_table to description tables
     include "./dd/0_2003_inc.php";
 }
 if ($version < 0.2004) {
     // adds Ethan's ordering table
     include "./dd/ordertable.php";
 }
 if ($version < 0.3001) {
     // add tables viewnames and tableviews
     include "./dd/0_3001_inc.php";
 }
 if ($version < 0.3002) {
     // add table construct
     // if the table exists already, we do not want to create it again
     if (!get_cell($db, 'tableoftables', 'id', 'tablename', 'constructs')) {
         include "./dd/0_3002_inc.php";
     }
 }
 if ($version < 0.41) {
     // Add column permissions2 to table users
     $db->Execute('ALTER TABLE users ADD COLUMN permissions2 int;');
 }
 if ($version < 0.62) {
     // Add table usersettings, to enable tying user settings to the IP address they are coming from (useful for 'open' guest accounts)
     include "./dd/0_6200_inc.php";
 }
 $query = "UPDATE settings SET version='{$version_code}' WHERE id=1";
 if (!$db->Execute($query)) {
     $test = false;
 }
开发者ID:nicost,项目名称:phplabware,代码行数:31,代码来源:setup.php

示例10: findCompletedTime

 function findCompletedTime($id)
 {
     //$status 0->Pending 1-> Accepted -> 2 Rejected ->3 Hold->4
     $status = get_cell('base', $id, 'ivr_flag');
     if ($status != 1 && $status != 2 && $status != 3) {
         return "Process..";
     } else {
         $udt = get_cell('base', $id, 'upload_date_time');
         if ($status == 1) {
             $ivr_time = get_cell('base', $id, 'ivr_accepted_timestamp');
         } else {
             if ($status == 2) {
                 $ivr_time = get_cell('base', $id, 'ivr_rejected_timestamp');
             } else {
                 if ($status == 3) {
                     $ivr_time = get_cell('base', $id, 'ivr_hold_timestamp');
                 }
             }
         }
         $time_diff = get_time_diff($udt, $ivr_time);
         return $time_diff;
     }
 }
开发者ID:clusterwebsolutions,项目名称:airtel_agent,代码行数:23,代码来源:db_functions.php

示例11: while

<?php

// Adds the table constructs
$newtablename = "constructs";
$newtablelabel = "constructs";
$newtableid = $db->GenID("tableoftables_gen_id_seq");
for ($i = 0; $i < $hownew; $i++) {
    $newtablelabel .= "new";
}
while (get_cell($db, "tableoftables", "id", "tablename", $newtablename)) {
    $newtablename .= "n";
    $hownew++;
}
for ($i = 0; $i < $hownew; $i++) {
    $newtablelabel .= "new";
}
$newtableshortname = substr($newtablename, 0, 3) . $newtableid;
$newtable_realname = $newtablename . "_" . $newtableid;
$newtable_desc_name = $newtable_realname . "_desc";
$r = $db->Execute("INSERT INTO tableoftables (id,sortkey,tablename,shortname,display,permission,custom,real_tablename,table_desc_name,label,plugin_code) VALUES ('{$newtableid}','0','{$newtablename}','{$newtableshortname}','Y','Users',NULL,'{$newtable_realname}','{$newtable_desc_name}','{$newtablelabel}','')");
$rg = $db->Execute("SELECT id FROM groups");
while (!$rg->EOF) {
    $groupid = $rg->fields[0];
    $db->Execute("INSERT INTO groupxtable_display VALUES ({$groupid},{$newtableid})");
    $rg->MoveNext();
}
if ($r) {
    $rb = $db->Execute("CREATE TABLE {$newtable_desc_name} (\n      id int NOT NULL,\n      sortkey int,\n      label text,\n      columnname text,\n      display_table char(1),\n      display_record char(1),\n      required char(1),\n      type text,\n      datatype text,\n      associated_table text,\n      associated_column text,\n      associated_local_key text,\n      key_table text,\n      thumb_x_size int,\n      thumb_y_size int,\n      link_first text,\n      link_last text,\n      modifiable char(1) )");
    if ($rb) {
        $newid = $db->GenID("{$newtable_desc_name}" . "_id");
        $db->Execute("INSERT INTO {$newtable_desc_name} VALUES({$newid},'100','id','id','N','N','N','int','text',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)");
开发者ID:nicost,项目名称:phplabware,代码行数:31,代码来源:0_3002_inc.php

示例12: microtime

}
if (!$pdffilecounter) {
    $pdffilecounter = 0;
}
$endtime = microtime();
list($startmu, $starts) = explode(" ", $starttime);
list($endmu, $ends) = explode(" ", $endtime);
$process = $ends - $starts;
$procesmu = $endmu - $startmu;
$pt = $process + $procesmu;
$ptime = sprintf("%0f", $pt);
echo "Indexed {$textfilecounter} text files and {$pdffilecounter} pdf files in {$ptime} seconds<br>";
// load plugin php code if it has been defined
if ($HTTP_GET_VARS['tablename']) {
    $tableinfo = new tableinfo($db);
    $plugin_code = get_cell($db, 'tableoftables', 'plugin_code', 'id', $tableinfo->id);
    if ($plugin_code) {
        @(include $plugin_code);
        // and execute the cron plugin
        if (function_exists('plugin_cron')) {
            plugin_cron($db, $tableinfo);
        }
    }
}
// we'll do the postgres maintenance
if (substr($db_type, 0, 8) == 'postgres') {
    $db->debug = true;
    $db->Execute('VACUUM');
    $db->Execute('ANALYZE');
    $db->Execute('VACUUM ANALYZE');
    $db->debug = false;
开发者ID:nicost,项目名称:phplabware,代码行数:31,代码来源:cron.php

示例13: fwrite

      $db->Execute("UPDATE $newtable_desc_name SET associated_table=\'$ass_table\' WHERE id=$newid");
      ');
        if ($s->fields[7] == 'mpulldown') {
            fwrite($fp, '$ask_table=$newtable_realname."ask_".$id_ass;
            $db->Execute("CREATE TABLE $ask_table (
               recordid int,
               typeid int)");
         $db->Execute("UPDATE $newtable_desc_name SET key_table=\'$ask_table\' WHERE id=$newid");
         ');
        }
    } elseif ($s->fields[7] == 'table') {
        $asstable_name = get_cell($db, 'tableoftables', 'tablename', 'id', $s->fields[8]);
        $asstable_descname = get_cell($db, 'tableoftables', 'table_desc_name', 'id', $s->fields[8]);
        $asscolumnname = get_cell($db, $asstable_descname, 'columnname', 'id', $s->fields[9]);
        // also do associated local column
        $asslocalcolumnname = get_cell($db, $table_desc, 'columnname', 'id', $s->fields[10]);
        // we need to write the whole description table and only then make the association to local columns:
        if ($asslocalcolumnname) {
            fwrite($fp, '$lid[]=$newid;
');
            fwrite($fp, '$lasscolumnname[]="' . $asslocalcolumnname . "\";\n");
        }
        fwrite($fp, '$asstable_id=get_cell($db,"tableoftables","id","tablename","' . $asstable_name . "\");\n");
        fwrite($fp, '$asstable_desc=get_cell($db,"tableoftables","table_desc_name","tablename","' . $asstable_name . "\");\n");
        fwrite($fp, '$asscolumn_id=get_cell($db,"$asstable_desc","id","columnname","' . $asscolumnname . "\");\n");
        fwrite($fp, '$db->Execute("UPDATE $newtable_desc_name SET associated_table=$asstable_id,associated_column=$asscolumn_id,key_table=NULL WHERE id=$newid");
      ');
    }
    $s->MoveNext();
}
// if there were associated local columns in the description table, create those link now
开发者ID:nicost,项目名称:phplabware,代码行数:31,代码来源:dumptable.php

示例14: find_nested_match

/**
 *  Searches (nested) for a match with $value 
 *
 * returns the id of the record in the associated value by searching recursively
 * that can be used in a SQL search
 */
function find_nested_match($db, $tableinfo, $field, $value, $first = true)
{
    $info = getvalues($db, $tableinfo, $field);
    if ($info[0]['datatype'] == 'table') {
        $ass_tableinfo = new tableinfo($db, $info[0]['ass_table_name']);
        $value = find_nested_match($db, $ass_tableinfo, $info[0]['ass_column_name'], $value, false);
    } elseif ($info[0]['datatype'] == 'int') {
        $value = trim($value);
        // I am getting desperate, but the browser inserts junk in the first postions, test if it is a number, if not, delete it.
        if (!is_numeric($value[0])) {
            $value = substr($value, 1);
        }
        return get_cell($db, $tableinfo->realname, 'id', $field, (int) $value);
    } elseif ($info[0]['datatype'] == 'float') {
        $value = trim($value);
        if (!is_numeric($value[0])) {
            $value = substr($value, 1);
        }
        return get_cell($db, $tableinfo->realname, 'id', $field, (double) $value);
    } elseif ($info[0]['datatype'] == 'pulldown') {
        $value = get_cell($db, $info[0]['ass_t'], 'id', 'typeshort', $value);
        return get_cell($db, $tableinfo->realname, 'id', $field, $value);
    } elseif (!$first) {
        return get_cell($db, $tableinfo->realname, 'id', $field, $value);
    }
    return $value;
}
开发者ID:nicost,项目名称:phplabware,代码行数:33,代码来源:general_inc.php

示例15: plugin_show

function plugin_show($db, $tableinfo, $id, $USER, $system_settings, $backbutton = true)
{
    global $PHP_SELF;
    $journaltable = get_cell($db, $tableinfo->desname, "associated_table", "columnname", "journal");
    $categorytable = get_cell($db, $tableinfo->desname, "associated_table", "columnname", "category");
    if (!may_read($db, $tableinfo, $id, $USER)) {
        return false;
    }
    // get values
    $r = $db->Execute("SELECT {$tableinfo->fields} FROM {$tableinfo->realname} WHERE id={$id}");
    if ($r->EOF) {
        echo "<h3>Could not find this record in the database</h3>";
        return false;
    }
    $column = strtok($tableinfo->fields, ",");
    while ($column) {
        ${$column} = $r->fields[$column];
        $column = strtok(",");
    }
    echo "&nbsp;<br>\n";
    echo "<table border=0 align='center'>\n";
    echo "<tr>\n";
    echo "<th>Article: </th>\n";
    echo "<td>{$title}<br>\n{$author}<br>\n";
    $text = get_cell($db, $journaltable, "type", "id", $journal);
    echo "{$text} ({$pubyear}), <b>{$volume}</b>:{$fpage}-{$lpage}\n";
    echo "</td></tr>\n";
    if ($abstract) {
        echo "<tr>\n<th>Abstract</th>\n";
        echo "<td>{$abstract}</td>\n</tr>\n";
    }
    // Category
    if ($category) {
        $type2 = get_cell($db, $categorytable, "type", "id", $category);
        echo "<tr>\n<th>Category</th>\n";
        echo "<td>{$type2}</td>\n</tr>\n";
    }
    echo "<tr>";
    $query = "SELECT firstname,lastname,email FROM users WHERE id={$ownerid}";
    $r = $db->Execute($query);
    if ($r->fields["email"]) {
        echo "<th>Submitted by: </th><td><a href='mailto:" . $r->fields["email"] . "'>";
        echo $r->fields["firstname"] . " " . $r->fields["lastname"] . "</a> ";
    } else {
        echo "<th>Submitted by: </th><td>" . $r->fields["firstname"] . " ";
        echo $r->fields["lastname"] . " ";
    }
    $dateformat = get_cell($db, "dateformats", "dateformat", "id", $system_settings["dateformat"]);
    $date = date($dateformat, $date);
    echo "({$date})</td>\n";
    echo "</tr>\n";
    if ($lastmodby && $lastmoddate) {
        echo "<tr>";
        $query = "SELECT firstname,lastname,email FROM users WHERE id={$lastmodby}";
        $r = $db->Execute($query);
        if ($r->fields["email"]) {
            echo "<th>Last modified by: </th><td><a href='mailto:" . $r->fields["email"] . "'>";
            echo $r->fields["firstname"] . " " . $r->fields["lastname"] . "</a>";
        } else {
            echo "<th>Last modified by: </th><td>" . $r->fields["firstname"] . " ";
            echo $r->fields["lastname"];
        }
        $dateformat = get_cell($db, "dateformats", "dateformat", "id", $system_settings["dateformat"]);
        $lastmoddate = date($dateformat, $lastmoddate);
        echo " ({$lastmoddate})</td>\n";
        echo "</tr>\n";
    }
    echo "<tr>";
    $notes = nl2br(htmlentities($notes));
    echo "<th>Notes: </th><td>{$notes}</td>\n";
    echo "</tr>\n";
    $columnid = get_cell($db, $tableinfo->desname, "id", "columnname", "file");
    $files = get_files($db, $tableinfo->name, $id, $columnid, 1);
    if ($files) {
        echo "<tr><th>Files:</th>\n<td>";
        for ($i = 0; $i < sizeof($files); $i++) {
            echo $files[$i]["link"] . " (" . $files[$i]["type"] . " file, " . $files[$i]["size"] . ")<br>\n";
        }
        echo "</tr>\n";
    }
    echo "<tr><th>Links:</th><td colspan=7><a href='{$PHP_SELF}?tablename=" . $tableinfo->name . "&showid={$id}&";
    echo SID;
    echo "'>" . $system_settings["baseURL"] . getenv("SCRIPT_NAME") . "?tablename=" . $tableinfo->name . "&showid={$id}</a> (This page)<br>\n";
    echo "<a href='http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?";
    if ($system_settings["pdfget"]) {
        $addget = "&" . $system_settings["pdfget"];
    }
    echo "cmd=Retrieve&db=PubMed&list_uids={$pmid}&dopt=Abstract{$addget}'>This article at Pubmed</a><br>\n";
    echo "<a href='http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?";
    echo "cmd=Link&db=PubMed&dbFrom=PubMed&from_uid={$pmid}{$addget}'>Related articles at Pubmed</a><br>\n";
    if ($supmat) {
        echo "<a href='{$supmat}'>Supplemental material</a><br>\n";
    }
    echo "</td></tr>\n";
    show_reports($db, $tableinfo, $id);
    ?>
   
<form method='post' id='pdfview' action='<?php 
    echo "{$PHP_SELF}?tablename=" . $tableinfo->name;
    ?>
//.........这里部分代码省略.........
开发者ID:nicost,项目名称:phplabware,代码行数:101,代码来源:pdfs_plugin.php


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