本文整理汇总了PHP中getFields函数的典型用法代码示例。如果您正苦于以下问题:PHP getFields函数的具体用法?PHP getFields怎么用?PHP getFields使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getFields函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: results
public function results()
{
if (!$this->isAdmin) {
$this->login();
}
$this->check();
$this->title("Manage " . $this->application);
$this->CSS("results", "cpanel");
$this->CSS("pagination");
$this->js("checkbox");
$trash = segment(3, isLang()) === "trash" ? TRUE : FALSE;
$total = $this->CPanel_Model->total($trash);
$thead = $this->CPanel_Model->thead("checkbox, " . getFields($this->application) . ", Action", FALSE);
$pagination = $this->CPanel_Model->getPagination($trash);
$tFoot = getTFoot($trash);
$this->vars["message"] = !$tFoot ? "Error" : NULL;
$this->vars["pagination"] = $pagination;
$this->vars["trash"] = $trash;
$this->vars["search"] = getSearch();
$this->vars["table"] = getTable(__(_("Manage " . ucfirst($this->application))), $thead, $tFoot, $total);
$this->vars["view"] = $this->view("results", TRUE, "cpanel");
$this->render("content", $this->vars);
}
示例2: thumbnailForm_submit
function thumbnailForm_submit($form, $form_state)
{
$params = drupal_get_query_parameters();
// getting the inputted info from the fields
$fields = array("FID");
$picData = getFields($fields, $form_state['values']);
$picData = stripTags($picData, '');
$oldFID = isset($form_state['oldFID']) ? $form_state['oldFID'] : 0;
if (isset($params["UID"])) {
// if updating user's profile picture
$UID = $params["UID"];
replacePicture($picData['FID'], $oldFID, 'Users');
dbUpdate("profiles", $picData, "UID", $UID);
drupal_goto("viewUser", array('query' => array('UID' => $UID)));
} else {
if (isset($params["OID"])) {
// if editing outreach thumbnail
$OID = $params["OID"];
replacePicture($picData['FID'], $oldFID, 'Outreach');
dbUpdateOutreach($OID, $picData);
drupal_goto("viewOutreach", array('query' => array('OID' => $OID)));
} else {
if (isset($params["TID"])) {
// if editing team thumbnail
$TID = $params["TID"];
replacePicture($picData['FID'], $oldFID, 'Teams');
dbUpdateTeam($TID, $picData);
drupal_goto("viewTeam", array('query' => array('TID' => $TID)));
} else {
drupal_goto("myDashboard");
}
}
}
}
示例3: notificationForm_submit
function notificationForm_submit($form, $form_state)
{
global $user;
$params = drupal_get_query_parameters();
$OID = $params['OID'];
// generate the notification
$notification = getFields(array('dateTargeted', 'message'), $form_state['values']);
$notification = stripTags($notification);
// allow some tags
$notification['dateTargeted'] = dbDatePHP2SQL(strtotime($notification['dateTargeted']));
$notification['bttnTitle'] = 'View Outreach';
$notification['bttnLink'] = '?q=viewOutreach&OID=' . $OID;
$notification['OID'] = $OID;
$notification['TID'] = dbGetTeamForOutreach($OID);
$notification['dateCreated'] = dbDatePHP2SQL(time());
foreach ($form_state['values']['UID'] as $UID) {
if ($UID != null) {
$notification['UID'] = $UID;
$result = dbAddNotification($notification);
}
}
if ($result) {
drupal_set_message('Notification added!');
drupal_goto('manageNotifications', array('query' => array('OID' => $OID)));
} else {
drupal_set_message('There was an error.', 'error');
}
}
示例4: usersSearch_submit
function usersSearch_submit($form, $form_state)
{
$names = array('nameContains');
$row = getFields($names, $form_state['values']);
$row = stripTags($row, '');
drupal_goto('showUsersForTeam', array('query' => array('query' => $row['nameContains'])));
return;
}
示例5: outreachPageHeader_submit
function outreachPageHeader_submit($form, &$form_state)
{
$fields = array('team');
$newTID = getFields($fields, $form_state['values'])['team'];
setCurrentTeam($newTID);
$teamNumber = dbGetTeamNumber($newTID);
drupal_set_message("Now operating under Team {$teamNumber}!");
drupal_goto('outreach');
}
示例6: createData
function createData()
{
$sections = array();
A::$DB->query("SELECT * FROM " . DOMAIN . "_sections WHERE module='shoplite' OR module='catalog' ORDER BY sort");
while ($row = A::$DB->fetchRow()) {
$_section = DOMAIN . "_" . $row['lang'] . "_" . $row['name'];
if (getFields($_section)) {
$sections[$_section] = $row['caption'];
}
}
A::$DB->free();
$this->Assign("sections", $sections);
if (!empty($_GET['section'])) {
$_section = preg_replace("/[^a-zA-Z0-9_-]/i", "", $_GET['section']);
if (isset($sections[$_section])) {
$section = $_section;
setcookie(STRUCTURE, $_GET['section'], time() + 31104000);
}
}
if (empty($section)) {
$section = preg_replace("/[^a-zA-Z0-9_-]/i", "", A_Session::get(STRUCTURE, isset($_COOKIE[STRUCTURE]) ? $_COOKIE[STRUCTURE] : key($sections)));
}
A_Session::set(STRUCTURE, $section);
$this->Assign("section", $section);
if (empty($section)) {
return;
}
$categories = A::$DB->getAll("SELECT id,idker,name FROM {$section}_categories ORDER BY level,sort");
$this->Assign("categories", $categories);
$idcat = !empty($_GET['idcat']) ? (int) $_GET['idcat'] : 0;
$_cfields = getTextOption(STRUCTURE, 'cfields');
$_cfields = !empty($_cfields) ? unserialize($_cfields) : array();
if (!isset($_cfields[$section])) {
$_cfields[$section] = $_cfields;
}
$_cfields = !empty($_cfields[$section][$idcat]) ? $_cfields[$section][$idcat] : array();
$cfields = cfields_getfields($idcat, $section);
foreach ($cfields as $field => $value) {
if (in_array($field, $_cfields)) {
unset($cfields[$field]);
}
}
$fields = array();
A::$DB->query("SELECT * FROM " . DOMAIN . "_fields WHERE item='{$section}' ORDER BY sort");
while ($row = A::$DB->fetchRow()) {
$row['disabled'] = isset($cfields[$row['field']]);
$row['checked'] = in_array($row['field'], $_cfields) || $row['disabled'];
$row['caption'] = $row['name_' . LANG];
$fields[] = $row;
}
A::$DB->free();
$this->Assign("fields", $fields);
}
示例7: generateDomainObjects
/**
* Enter description here...
*
* @param unknown_type $ret
* @return
*/
function generateDomainObjects($ret){
for($i=0;$i<count($ret);$i++){
if(!doesTableContainPK($ret[$i])){
continue;
}
$tableName = $ret[$i][0];
$clazzName = getClazzName($tableName);
if($clazzName[strlen($clazzName)-1]=='s'){
$clazzName = substr($clazzName, 0, strlen($clazzName)-1);
}
$template = new Template('templates/Domain.tpl');
$template->set('domain_class_name', $clazzName);
$template->set('table_name', $tableName);
$tab = getFields($tableName);
$fields = "";
$initFields = "";
$getsetMethods = "\n";
$toStrFields = "return ''";
for($j=0;$j<count($tab);$j++) {
$fieldName = getVarNameWithS($tab[$j][0]);
$fields .= "\tprivate $".$fieldName.";\n";
$initFields .= "\t\tif (isset(\$fields['".$fieldName."'])) \$this->".$fieldName." = \$fields['".$fieldName."'];\n";
$camelFieldName = $fieldName;
$camelFieldName[0] = strtoupper($fieldName[0]);
$getsetMethods .= "\tpublic function get$camelFieldName() {\n\t\treturn \$this->$fieldName;\n\t}\n";
$getsetMethods .= "\tpublic function set$camelFieldName($".$fieldName.") {\n\t\t\$this->fields['$fieldName'] = $".$fieldName.";\n\t\t\$this->$fieldName = $".$fieldName.";\n\t}\n\n";
$toStrFields .= ".':'.\$this->".$fieldName;
}
$toStrFields .= ";";
$template->set('variables', $fields);
$template->set('init_variables', $initFields);
$template->set('getset_methods', $getsetMethods);
$template->set('tostr_variables', $toStrFields);
$template->set('date', date("Y-m-d H:i"));
$template->write('generated/'.$clazzName.'.php');
}
}
示例8: session_start
<?php
// Author : Wisnu
// Email : -
// Start : 25 Maret 2009
session_start();
include_once "../dwo.lib.php";
include_once "../db.mysql.php";
include_once "../connectdb.php";
include_once "../parameter.php";
include_once "../cekparam.php";
include_once "../fpdf.php";
$pmbid = $_REQUEST['pmbid'];
$pmb = getFields('pmb', "PMBID", $pmbid, '*');
$ProdiNama = getFields('prodi', "ProdiID", $pmb['ProdiID'], 'Nama');
$pdf = new FPDF('P', 'mm', 'A4');
$pdf->AddPage();
$identitas = GetFields('identitas', 'Kode', KodeID, '*');
$pdf->Image('../img/logo.jpg', 10, 10, 20);
$pdf->SetFont('Arial', 'B', 10);
$pdf->Cell(10, 6, '', 0, 0);
$pdf->Cell(75, 6, 'KARTU TANDA MAHASISWA SEMENTARA', 0, 1, 'C');
$pdf->SetFont('Helvetica', 'B', 15);
$pdf->SetTextColor(0, 0, 0);
$pdf->Cell(10, 15, '', 0, 0);
$pdf->Cell(75, 6, $identitas['Nama'], 0, 1, 'C');
$pdf->Ln(5);
$pdf->SetFont('Courier', 'B', 18);
$pdf->SetTextColor(0, 0, 0);
$pdf->Cell(5, 10, '', 0, 0);
$pdf->Cell(50, 10, $pmb['MhswID'], 0, 1);
示例9: experimentHasTime
function experimentHasTime($eid)
{
$fields = getFields($eid);
if ($fields != NULL) {
foreach ($fields as $f) {
// If the type if 7
if ($f['type_id'] == 7) {
return $f['type_name'];
}
}
}
return false;
}
示例10: teamSummary_submit
function teamSummary_submit($form, &$form_state)
{
$fields = array('team');
$newTID = getFields($fields, $form_state['values'])['team'];
setCurrentTeam($newTID);
$teamNumber = dbGetTeamNumber($newTID);
drupal_set_message("Now operating under Team {$teamNumber}!");
drupal_goto('teamDashboard');
}
示例11: session_start
<?php
// Author : Wisnu
// Email : -
// Start : 25 Maret 2009
session_start();
include_once "../dwo.lib.php";
include_once "../db.mysql.php";
include_once "../connectdb.php";
include_once "../parameter.php";
include_once "../cekparam.php";
include_once "../fpdf.php";
$pmbid = $_REQUEST['pmbid'];
$pmb = getFields('pmb', "PMBID", $pmbid, '*');
$pdf = new FPDF('P', 'mm', 'A4');
$pdf->AddPage();
$identitas = GetFields('identitas', 'Kode', KodeID, '*');
$pdf->Image('../img/logo.jpg', 10, 10, 20);
$pdf->SetFont('Arial', 'B', 10);
$pdf->Cell(20, 6, '', 0, 0);
$pdf->Cell(75, 6, 'KARTU TANDA MAHASISWA SEMENTARA', 0, 1, 'C');
$pdf->SetFont('Helvetica', 'B', 15);
$pdf->SetTextColor(0, 0, 0);
$pdf->Cell(20, 15, '', 0, 0);
$pdf->Cell(75, 15, $identitas['Nama'], 0, 1, 'C');
$pdf->SetFont('Courier', 'B', 18);
$pdf->SetTextColor(0, 0, 0);
$pdf->Cell(5, 10, '', 0, 0);
$pdf->Cell(50, 10, $pmb['MhswID'], 0, 1);
$pdf->SetFont('Arial', '', 6);
$pdf->Cell(55, 4, 'NOMOR POKOK MAHASISWA', 0, 1);
示例12: outreachForm_submit
function outreachForm_submit($form, $form_state)
{
global $user;
$UID = $user->uid;
$TID = $form_state['TID'];
$outreachFields = array("name", "peopleImpacted", "address", "city", "state", "country", "status", "co_organization", "co_firstName", "co_lastName", "co_email", "co_phoneNumber", "isPublic");
$outreachData = getFields($outreachFields, $form_state['values']);
$outreachData = stripTags($outreachData, '');
// remove all tags
$outreachData['description'] = stripTags(array($form_state['values']['description']));
// allow some tags
$outreachData["TID"] = $TID;
if ($form_state['new']) {
$outreachData["UID"] = $UID;
}
if (isset($form_state['OID'])) {
$OID = $form_state['OID'];
$oldOutreachData = dbGetOutreach($OID);
if ($outreachData["status"] == "doingWriteUp" && $oldOutreachData["isWriteUpApproved"] == true) {
$outreachData["writeUpUID"] = null;
$outreachData["isWriteUpSubmitted"] = 0;
$outreachData["isWriteUpApproved"] = 0;
}
}
if (!$form_state['new']) {
// updating existing event
$OID = $form_state['OID'];
$result = dbUpdateOutreach($OID, $outreachData);
if ($result) {
// if db call was successful
for ($i = 0; $i < $form_state['numRows']; $i++) {
// loop through date rows
$TOID = isset($form_state['fields']['dates']["TOID-{$i}"]) ? $form_state['fields']['dates']["TOID-{$i}"] : 0;
$timeData['startTime'] = dbDatePHP2SQL(strtotime($form_state['values']["startTime-{$i}"]));
dpm($timeData['startTime']);
$timeData['endTime'] = dbDatePHP2SQL(strtotime($form_state['values']["endTime-{$i}"]));
if ($timeData['startTime'] != null && $timeData['endTime'] != null) {
// if row isn't empty
if ($TOID != 0) {
// update existing record
dbUpdateTimesForOutreach($TOID, $timeData);
} else {
// add a new time record if there wasn't one previously
$timeData['OID'] = $OID;
dbAddTimesToOutreach($timeData);
}
} else {
// remove time record if empty
dbRemoveTimeFromOutreach($TOID);
}
}
for ($i = $form_state['numRows']; $i < $form_state['initialNumTimes']; $i++) {
// executes if times were deleted
dbRemoveTimeFromOutreach($form_state['fields']['dates']["TOID-{$i}"]);
}
$notification = array();
$userName = dbGetUserName($user->uid);
$outName = dbGetOutreachName($OID);
$notification['dateCreated'] = dbDatePHP2SQL(time());
$notification['dateTargeted'] = dbDatePHP2SQL(time());
$notification['message'] = "{$userName} has updated outreach {$outName}.";
$notification['bttnTitle'] = 'View';
$notification['bttnLink'] = '?q=viewOutreach&OID=' . $OID;
$notification['TID'] = $TID;
notifyUsersByRole($notification, 'moderator');
// handle tags
if (!empty($form_state['values']['tags'])) {
$newTags = $form_state['values']['tags'];
$previous = dbGetTagsForOutreach($OID, true);
// the "true" means this will return only OTID's
if ($previous == false) {
// if there aren't any tags
$previous = array();
}
$deleted = array_diff($previous, $newTags);
$added = array_diff($newTags, $previous);
foreach ($deleted as $delete) {
// $delete is the OTID to be removed from the outreach
if (!empty($delete)) {
dbRemoveTagFromOutreach($delete, $OID);
}
}
foreach ($added as $add) {
// $add is the OTID to be added to the outreach
if (!empty($add)) {
dbAddTagToOutreach($add, $OID);
}
}
}
drupal_set_message("Outreach updated!");
} else {
drupal_set_message("Outreach not updated.");
}
} else {
// adding new event
$outreachData['logDate'] = dbDatePHP2SQL(time());
$OID = dbCreateOutreach($outreachData);
if ($OID != false) {
dbAddUserAsOwnerOfOutreach($UID, $OID);
dbAssignUserToOutreach($UID, $OID, 'owner');
//.........这里部分代码省略.........
示例13: foreach
// Get experiment Id for each session
foreach ($sessionIds as $sid) {
$eid = getSessionExperimentId($sid);
$data[] = array('experimentId' => $aid != -1 ? $aid : $eid, 'sessionId' => $sid, 'fields' => getFields($eid), 'meta' => array(getSession($sid)), 'data' => getData($eid, $sid));
}
} else {
$eid = getSessionExperimentId($sessionIds[0]);
$data['id'] = $eid;
$data['meta'] = getExperiment($eid);
$data['sessions'] = array();
foreach ($sessionIds as $sid) {
$x = array();
$x['id'] = $sid;
$x['meta'] = array(getSession($sid));
$x['data'] = getData($eid, $sid);
$x['fields'] = getFields($eid);
$x['visibility'] = true;
$data['sessions'][] = $x;
}
}
} else {
if (isset($_GET['vsessions'])) {
}
}
for ($i = 0; $i < count($data[0]['fields']); $i++) {
if ($data[0]['fields'][$i]['type_id'] == 7) {
$tf = $i;
}
}
if (isset($tf)) {
if (is_numeric($data[0]['data'][0][$tf])) {
示例14: safeString
$state = (int) safeString($_REQUEST['state']);
} else {
$state = IDENTIFY;
}
if (isset($_POST['timefix'])) {
$timefix = $_POST['timefix'];
}
if (isset($_POST['columnfix'])) {
$columnfix = $_POST['columnfix'];
}
if (isset($_REQUEST['id'])) {
$eid = isset($_POST['id']) ? $_POST['id'] : $_GET['id'];
if ($meta = getExperiment($eid)) {
$ownerid = $meta['owner_id'];
$title = ucwords($meta['name']) . " - Add New Session";
$fields = getFields($eid);
}
//$fields = array_slice($fields, 1);
$smarty->assign('meta', $meta);
$smarty->assign('title', $title);
$smarty->assign('fields', $fields);
$smarty->assign('field_count', count($fields));
} else {
array_push($errors, 'Could not find your experiment.');
}
// Check to see if we have started the form process yet
if (isset($_POST['session_create']) && count($errors) == 0) {
$type = isset($_POST['session_type']) ? safeString($_POST['session_type']) : "file";
$smarty->assign('session_type', $type);
// Check to ensure we get all the experiment meta
$post_data = array('session_name' => "", 'session_description' => "", 'session_street' => "", 'session_citystate' => "", 'session_type' => "");
示例15: hoursForm_submit
function hoursForm_submit($form, $form_state)
{
global $user;
// getting value of new from form state
$new = isset($form_state['new']) ? $form_state['new'] : true;
$OID = $form_state['OID'];
// looping through the rows of hours
for ($i = 0; $i < $form_state['numRows']; $i++) {
$fields = array("numberOfHours-{$i}", "description-{$i}", "type-{$i}");
$row = getFields($fields, $form_state['values']);
// dont allow any html tags
$row = stripTags($row, '');
// setting the values which were read in into the row which will go into the database
$row['numberOfHours'] = $row["numberOfHours-{$i}"];
$row['description'] = $row["description-{$i}"];
$row['isApproved'] = 0;
$row['type'] = $row["type-{$i}"];
unset($row["type-{$i}"], $row["numberOfHours-{$i}"], $row["description-{$i}"]);
if (isset($form_state['values']['fields']['UID'])) {
$UID = $form_state['values']['fields']['UID'];
} else {
$UID = $user->uid;
}
if ($UID != 0) {
$row['UID'] = $UID;
}
$row['OID'] = $OID;
// if adding new hours
if ($new) {
if (dbLogHours($row) == false) {
drupal_set_message("Error", 'error');
break;
}
} else {
// editing old hours
$row['isApproved'] = 0;
if (dbUpdateHours($row, $form_state['HID']) == false) {
drupal_set_message("Error", 'error');
break;
}
}
}
// end of for loop
drupal_set_message("Your hours have been logged!");
// assigning user to outreach if not new
if (!$new) {
dbAssignUserToOutreach($UID, $OID, $row['type']);
drupal_goto("viewOutreach", array('query' => array("OID" => $OID)));
} else {
// notifying appropriate users of changes/addition of hours
$outreachName = dbGetOutreachName($OID);
$personName = dbGetUserName($user->uid);
$notification['message'] = "{$personName} has logged hours for {$outreachName}!";
$notification['TID'] = dbGetTeamForOutreach($OID);
$notification['dateTargeted'] = dbDatePHP2SQL(time());
$notification['dateCreated'] = dbDatePHP2SQL(time());
notifyUsersByRole($notification, 'moderator');
notifyOwnerOfOutreach($OID, $notification);
if ($OID != 0) {
drupal_goto("viewHours", array('query' => array("OID" => $OID)));
} else {
drupal_goto("viewHours", array('query' => array("UID" => $UID)));
}
}
}