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


PHP PHPWS_DB::getRow方法代码示例

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


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

示例1: check_magic_winner

 /**
  * Looks for an entry with the 'magic_winner' flag set and returns it, otherwise it returns null
  */
 public static function check_magic_winner($term)
 {
     $now = time();
     $query = "SELECT * FROM hms_new_application JOIN hms_lottery_application ON hms_new_application.id = hms_lottery_application.id\n                    LEFT OUTER JOIN (SELECT asu_username FROM hms_assignment WHERE term={$term}) as foo ON hms_new_application.username = foo.asu_username\n                    WHERE foo.asu_username IS NULL AND (hms_lottery_application.invite_expires_on < {$now} OR hms_lottery_application.invite_expires_on IS NULL)\n                    AND hms_new_application.term = {$term}\n                    AND hms_lottery_application.magic_winner = 1";
     $result = PHPWS_DB::getRow($query);
     if (PEAR::isError($result)) {
         PHPWS_Error::log($result);
         return null;
     }
     if (!isset($result) || empty($result)) {
         return null;
     } else {
         return $result;
     }
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:18,代码来源:HMS_Lottery.php

示例2: getDepartmentById

 /**
  * Returns a Department object based on the given department ID.
  * @param unknown $id
  * @return Department
  */
 public static function getDepartmentById($id)
 {
     // Sanity checking
     if (!isset($id) || $id === '') {
         throw new \InvalidArgumentException('Missing department ID.');
     }
     // Query
     $query = "SELECT * FROM intern_department WHERE id = {$id}";
     $result = \PHPWS_DB::getRow($query);
     if (\PHPWS_Error::isError($result)) {
         throw new DatabaseException($result->toString());
     }
     if (sizeof($result) == 0) {
         return null;
     }
     // Create the object and set member variables
     $department = new DepartmentDB();
     $department->setId($result['id']);
     $department->setName($result['name']);
     $department->setHidden($result['hidden']);
     $department->setCorequisite($result['corequisite']);
     return $department;
 }
开发者ID:jlbooker,项目名称:InternshipInventory,代码行数:28,代码来源:DepartmentFactory.php

示例3: getFacultyObjectById

 public static function getFacultyObjectById($id)
 {
     if (!isset($id)) {
         throw new \InvalidArgumentException('Missing faculty id.');
     }
     $sql = "SELECT intern_faculty.* FROM intern_faculty WHERE intern_faculty.id = {$id}";
     $row = \PHPWS_DB::getRow($sql);
     if (\PHPWS_Error::logIfError($row)) {
         throw new Exception($row);
     }
     $faculty = new FacultyDB();
     $faculty->setId($row['id']);
     $faculty->setUsername($row['username']);
     $faculty->setFirstName($row['first_name']);
     $faculty->setLastName($row['last_name']);
     $faculty->setPhone($row['phone']);
     $faculty->setFax($row['fax']);
     $faculty->setStreetAddress1($row['street_address1']);
     $faculty->setStreetAddress2($row['street_address2']);
     $faculty->setCity($row['city']);
     $faculty->setState($row['state']);
     $faculty->setZip($row['zip']);
     return $faculty;
 }
开发者ID:jlbooker,项目名称:InternshipInventory,代码行数:24,代码来源:FacultyFactory.php

示例4: view

 /**
  *
  *
  *
  *
  */
 function view($showLinks = TRUE)
 {
     /* Find the key into the entries array for the selected entry */
     foreach ($this->_entries as $entryKey => $entryValue) {
         if ($entryValue['id'] == $_REQUEST['PHAT_ENTRY_ID']) {
             break;
         }
     }
     /* Get the data for the selected entry from the database */
     $sql = 'SELECT * FROM ' . $this->getFormTable() . " WHERE id='" . $_REQUEST['PHAT_ENTRY_ID'] . "'";
     $entry = PHPWS_DB::getRow($sql);
     $rowClass = NULL;
     $entryTags = array();
     $entryTags['ENTRY_DATA'] = NULL;
     /* Step through the entries values and feed them through the entryRow template */
     $toggle = 1;
     foreach ($entry as $key => $value) {
         $rowTags = array();
         if ($key == 'position') {
             continue;
         } elseif ($key == 'updated') {
             $value = date(PHPWS_DATE_FORMAT . ' ' . PHPWS_TIME_FORMAT, $value);
         }
         $attribute = ' class="bgcolor1" ';
         /* Toggle the row colors for better visability */
         if ($toggle % 2) {
             $rowClass = $attribute;
         } else {
             $rowClass = null;
         }
         $toggle++;
         if (isset($rowClass)) {
             $rowTags['ROW_CLASS'] = $rowClass;
         }
         $rowTags['ENTRY_LABEL'] = $key;
         if (preg_match('/a:\\d+:{/', $value)) {
             $rowTags['ENTRY_VALUE'] = implode(', ', unserialize($value));
         } else {
             $rowTags['ENTRY_VALUE'] = PHPWS_Text::parseOutput($value, ENCODE_PARSED_TEXT, false, true);
         }
         $entryTags['ENTRY_DATA'] .= PHPWS_Template::processTemplate($rowTags, 'phatform', 'report/entryRow.tpl');
     }
     if (isset($this->archive)) {
         $entryTags['BACK_LINK'] = $_SESSION['PHAT_advViews']->getArchiveViewLink();
     }
     if ($showLinks && !isset($_REQUEST['lay_quiet'])) {
         $entryTags['PRINT'] = '<a href="index.php?module=phatform&amp;PHAT_REPORT_OP=view&amp;PHAT_ENTRY_ID=' . $_REQUEST['PHAT_ENTRY_ID'] . '&amp;lay_quiet=1" target="_blank">' . dgettext('phatform', 'Print View') . '</a>';
         /* Show the next and/or previous links to step through entries */
         if ($entryKey < sizeof($this->_entries) - 1) {
             $entryTags['NEXT'] = '<a href="index.php?module=phatform&amp;PHAT_REPORT_OP=view&amp;PHAT_ENTRY_ID=' . $this->_entries[$entryKey + 1]['id'] . '">' . dgettext('phatform', 'Next Entry') . '</a>';
         }
         if ($entryKey > 0) {
             $entryTags['PREVIOUS'] = '<a href="index.php?module=phatform&amp;PHAT_REPORT_OP=view&amp;PHAT_ENTRY_ID=' . $this->_entries[$entryKey - 1]['id'] . '">' . dgettext('phatform', 'Previous Entry') . '</a>';
         }
     }
     $GLOBALS['CNT_phatform']['title'] = $_SESSION['PHAT_FormManager']->form->getLabel();
     /* Return the entire processed entry */
     if (isset($_REQUEST['lay_quiet'])) {
         echo PHPWS_Template::processTemplate($entryTags, 'phatform', 'report/entry.tpl');
     } else {
         return PHPWS_Template::processTemplate($entryTags, 'phatform', 'report/entry.tpl');
     }
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:69,代码来源:Report.php

示例5: getMagicWinner

 private function getMagicWinner()
 {
     $query = "SELECT * FROM hms_new_application JOIN hms_lottery_application ON hms_new_application.id = hms_lottery_application.id\n                            LEFT OUTER JOIN (SELECT asu_username FROM hms_assignment WHERE term = {$this->term}) as foo ON hms_new_application.username = foo.asu_username\n                            WHERE foo.asu_username IS NULL AND (hms_lottery_application.invited_on IS NULL)\n                            AND hms_new_application.term = {$this->term}\n                            AND hms_lottery_application.magic_winner = 1";
     $result = PHPWS_DB::getRow($query);
     if (PHPWS_Error::logIfError($result)) {
         throw new DatabaseException($result->toString());
     }
     return $result;
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:9,代码来源:LotteryProcess.php

示例6: _editOptions

 function _editOptions()
 {
     if (Current_User::allow('phatform', 'edit_options')) {
         if (isset($_REQUEST['PHAT_OptionSetId']) && !is_numeric($_REQUEST['PHAT_OptionSetId']) || isset($_REQUEST['PHAT_OptionBack'])) {
             $_REQUEST['PHAT_MAN_OP'] = 'Options';
             $this->action();
             return;
         } else {
             $optionSetId = $_REQUEST['PHAT_OptionSetId'];
         }
         if (isset($_REQUEST['PHAT_SaveOptionSet'])) {
             if (is_array($_REQUEST['PHAT_ElementOptions']) && is_array($_REQUEST['PHAT_ElementValues'])) {
                 for ($i = 0; $i < sizeof($_REQUEST['PHAT_ElementOptions']); $i++) {
                     $_REQUEST['PHAT_ElementOptions'][$i] = PHPWS_Text::parseInput($_REQUEST['PHAT_ElementOptions'][$i]);
                     $_REQUEST['PHAT_ElementValues'][$i] = PHPWS_Text::parseInput($_REQUEST['PHAT_ElementValues'][$i]);
                 }
                 $options = addslashes(serialize($_REQUEST['PHAT_ElementOptions']));
                 $values = addslashes(serialize($_REQUEST['PHAT_ElementValues']));
                 $saveArray = array('optionSet' => $options, 'valueSet' => $values);
                 $db = new PHPWS_DB('mod_phatform_options');
                 $db->addWhere('id', $optionSetId);
                 $db->addValue($saveArray);
                 $db->update();
             }
         } else {
             if (isset($_REQUEST['PHAT_delete'])) {
                 $db = new PHPWS_DB('mod_phatform_options');
                 $db->addWhere('id', $optionSetId);
                 $db->delete();
                 $_REQUEST['PHAT_MAN_OP'] = 'Options';
                 $this->action();
                 return;
             }
         }
         $GLOBALS['CNT_phatform']['title'] = PHAT_TITLE;
         $sql = "SELECT * FROM mod_phatform_options WHERE id='{$optionSetId}'";
         $result = PHPWS_DB::getRow($sql);
         if ($result) {
             $elements = array();
             $elements[] = PHPWS_Form::formHidden('module', $this->_module);
             $elements[] = PHPWS_Form::formHidden('PHAT_MAN_OP', 'editOptions');
             $elements[] = PHPWS_Form::formHidden('PHAT_OptionSetId', $optionSetId);
             $options = unserialize(stripslashes($result['optionSet']));
             $values = unserialize(stripslashes($result['valueSet']));
             $editTags = array();
             $editTags['TITLE'] = dgettext('phatform', 'Edit option set') . "&#160;{$result['label']}";
             $editTags['NUMBER_LABEL'] = dgettext('phatform', 'Option');
             $editTags['INPUT_LABEL'] = dgettext('phatform', 'Text');
             $editTags['VALUE_LABEL'] = dgettext('phatform', 'Value');
             $editTags['OPTIONS'] = '';
             $rowClass = NULL;
             for ($i = 0; $i < sizeof($options); $i++) {
                 $optionRow['OPTION_NUMBER'] = $i + 1;
                 $optionRow['OPTION_INPUT'] = PHPWS_Form::formTextField("PHAT_ElementOptions[{$i}]", $options[$i], PHAT_DEFAULT_SIZE, PHAT_DEFAULT_MAXSIZE);
                 $optionRow['VALUE_INPUT'] = PHPWS_Form::formTextField("PHAT_ElementValues[{$i}]", $values[$i], PHAT_DEFAULT_SIZE, PHAT_DEFAULT_MAXSIZE);
                 $optionRow['ROW_CLASS'] = $rowClass;
                 if ($i % 2) {
                     $rowClass = ' class="bgcolor1"';
                 } else {
                     $rowClass = null;
                 }
                 $editTags['OPTIONS'] .= PHPWS_Template::processTemplate($optionRow, 'phatform', 'options/option.tpl');
             }
         }
         $editTags['BACK_BUTTON'] = PHPWS_Form::formSubmit(dgettext('phatform', 'Back'), 'PHAT_OptionBack');
         $editTags['SAVE_BUTTON'] = PHPWS_Form::formSubmit(dgettext('phatform', 'Save'), 'PHAT_SaveOptionSet');
         $elements[] = PHPWS_Template::processTemplate($editTags, 'phatform', 'options/optionList.tpl');
         return PHPWS_Form::makeForm('PHAT_Options_edit', 'index.php', $elements);
     } else {
         $this->_list();
     }
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:72,代码来源:FormManager.php


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