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


PHP df_get_records_array函数代码示例

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


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

示例1: beforeDelete

 function beforeDelete($record)
 {
     $versions = df_get_records_array('webpage_versions', array('webpage_id' => '=' . $record->val('webpage_id')));
     while ($versions) {
         foreach ($versions as $version) {
             $res = $version->delete(true);
             if (PEAR::isError($res)) {
                 return $res;
             }
         }
         $versions = df_get_records_array('webpage_versions', array('webpage_id' => '=' . $record->val('webpage_id')));
     }
     $logs = df_get_records_array('webpage_check_log', array('webpage_id' => '=' . $record->val('webpage_id')));
     while ($logs) {
         foreach ($logs as $log) {
             $res = $log->delete(true);
             if (PEAR::isError($res)) {
                 return $res;
             }
         }
         $logs = df_get_records_array('webpage_check_log', array('webpage_id' => '=' . $record->val('webpage_id')));
     }
     $children = df_get_records_array('webpages', array('parent_id' => '=' . $record->val('webpage_id')));
     while ($children) {
         foreach ($children as $child) {
             $res = $child->delete(true);
             if (PEAR::isError($res)) {
                 return $res;
             }
         }
         $children = df_get_records_array('webpages', array('parent_id' => '=' . $record->val('webpage_id')));
     }
 }
开发者ID:gtoffoli,项目名称:swete,代码行数:33,代码来源:webpages.php

示例2: test_html

 function test_html()
 {
     $s =& Dataface_Table::loadTable('Profiles');
     $records = df_get_records_array('Profiles');
     $grid = new Dataface_dhtmlxGrid_grid($s->fields(), $records);
     echo $grid->toXML();
 }
开发者ID:Zunair,项目名称:xataface,代码行数:7,代码来源:dhtmlxGridTest.php

示例3: handle

 function handle(&$params)
 {
     try {
         $app =& Dataface_Application::getInstance();
         $query =& $app->getQuery();
         $auth =& Dataface_AuthenticationTool::getInstance();
         $user =& $auth->getLoggedInUser();
         if (!isset($query['-site-id'])) {
             throw new Exception("No site id specified");
         }
         if (isset($query['-compiled'])) {
             if ($query['-compiled'] == 'true' || $query['-compiled'] == 1) {
                 $compiled = 1;
             } else {
                 $compiled = 0;
             }
             $jobs = df_get_records_array('jobs', array('website_id' => $query['-site-id'], 'posted_by' => $user->val('username'), 'compiled' => $compiled));
         } else {
             $jobs = df_get_records_array('jobs', array('website_id' => $query['-site-id'], 'posted_by' => $user->val('username')));
         }
         //array of job ids and job titles to present to user
         $results = array();
         foreach ($jobs as $job) {
             $results[] = array('job_id' => $job->val('job_id'), 'title' => $job->getTitle());
         }
         echo json_encode($results);
     } catch (Exception $e) {
         if ($e->getCode() == E_USER_ERROR) {
             echo $e->getMessage();
         } else {
             throw $e;
         }
     }
 }
开发者ID:gtoffoli,项目名称:swete,代码行数:34,代码来源:swete_get_jobs_for_site.php

示例4: handle

 function handle(&$params)
 {
     try {
         $app = Dataface_Application::getInstance();
         $query = $app->getQuery();
         $selectedRecords = df_get_selected_records($query);
         $isNewJob = false;
         if ($query['-job'] && is_numeric($query['-job'])) {
             $selectedJob = df_get_record('jobs', array('job_id' => '=' . $query['-job']));
         } else {
             //no job was selected by user
             $site_id = $selectedRecords[0]->val('website_id');
             $jobs = df_get_records_array('jobs', array('website_id' => $site_id, 'compiled' => 'false'));
             $createNewJob = false;
             if ($query['-job'] == "new") {
                 $createNewJob = true;
             }
             if (count($jobs) == 0 || $createNewJob) {
                 //create a new job
                 $selectedJob = SweteJob::createJob(SweteSite::loadSiteById($site_id))->getRecord();
                 $isNewJob = true;
             } else {
                 if (count($jobs) == 1) {
                     //only one available job
                     $selectedJob = $jobs[0];
                 } else {
                     throw new Exception("No Job id was specified, but there are " . $count($jobs) . " available jobs to add to");
                 }
             }
         }
         if (!$selectedJob) {
             throw new Exception("Job could not be found", E_USER_ERROR);
         }
         if (!$selectedJob->checkPermission('edit')) {
             throw new Exception("You don't have permission to edit this job");
         }
         $job = new SweteJob($selectedJob);
         $stringsAdded = array();
         foreach ($selectedRecords as $record) {
             if (intval($record->val('website_id')) !== intval($selectedJob->val("website_id"))) {
                 throw new Exception("The string " . $record->val('string') . " is not in the same site as the job.");
             }
             //If string was already added to ANOTHER job, it doesn't matter
             //It will also be added to this one
             //if string was already added to this job, do nothing
             if (!$job->containsString($record->val('string'))) {
                 $job->addTranslationMiss($record->val('translation_miss_log_id'));
                 array_push($stringsAdded, $record->val('string'));
             }
         }
         $results = array('stringsAdded' => $stringsAdded, 'jobId' => $selectedJob->val('job_id'), 'isNewJob' => $isNewJob);
         echo json_encode($results);
     } catch (Exception $e) {
         if ($e->getCode() == E_USER_ERROR) {
             echo $e->getMessage();
         } else {
             throw $e;
         }
     }
 }
开发者ID:gtoffoli,项目名称:swete,代码行数:60,代码来源:swete_add_selected_strings_to_job.php

示例5: handle

    function handle(&$params)
    {
        $app =& Dataface_Application::getInstance();
        $query =& $app->getQuery();
        //$query['-skip'] = 0;
        //$query['-limit'] = 1000;
        if ($query['-table'] != 'payments') {
            return PEAR::raiseError('This action can only be called on the payments table.');
        }
        $payments = df_get_records_array('payments', $query);
        ?>
       
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Language" content="en-us" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Payment Report</title>
<link href="css/print.css" rel="stylesheet" type="text/css" media="print, screen" />
</head>

<body onload="javascript:window.print()">

<table style="width: 100%" cellpadding="3" class="centered">
	<tr class="cell_header">
		<td class="cell_header">ID</td>
		<td class="cell_header">Invoice ID</td>
		<td class="cell_header">Invoice Date</td>
		<td class="cell_header">Customer</td>
		<td class="cell_header">Labor Total</td>
		<td class="cell_header">Parts Total</td>
		<td class="cell_header">Tax</td>
		<td class="cell_header">Total</td>
		<td class="cell_header">Payment Date</td>
		<td class="cell_header">Payment</td>
	</tr>
	



<?php 
        foreach ($payments as $p) {
            echo '<tr class="cell">';
            echo '<td class="cell">' . $p->htmlValue('id') . '</td>';
            echo '<td class="cell">' . $p->htmlValue('invoiceid') . '</td>';
            echo '<td class="cell">' . $p->htmlValue('invoicedate') . '</td>';
            echo '<td class="cell">' . $p->htmlValue('customer') . '</td>';
            echo '<td class="cell">' . $p->htmlValue('labortotal') . '</td>';
            echo '<td class="cell">' . $p->htmlValue('partstotal') . '</td>';
            echo '<td class="cell">' . $p->htmlValue('tax') . '</td>';
            echo '<td class="cell">' . $p->htmlValue('total') . '</td>';
            echo '<td class="cell">' . $p->htmlValue('date') . '</td>';
            echo '<td class="cell_right_end">' . $p->htmlValue('amount') . '</td>';
            echo '</tr>';
        }
        echo '</table></body></html>';
    }
开发者ID:promoso,项目名称:HVAC,代码行数:58,代码来源:payments_report.php

示例6: df_get_records_array

 function &getRecords()
 {
     $app =& Dataface_Application::getInstance();
     $query = $app->getQuery();
     $query['-skip'] = 0;
     $query['-limit'] = 500;
     $records =& df_get_records_array($query['-table'], $query);
     return $records;
 }
开发者ID:promoso,项目名称:HVAC,代码行数:9,代码来源:set_translation_status.php

示例7: handleGet_noSettingsId

 function handleGet_noSettingsId($params)
 {
     $app = Dataface_Application::getInstance();
     $sites_to_import = array();
     $sites = df_get_records_array('websites', array());
     foreach ($sites as $site) {
         if ($site->checkPermission('import webpages')) {
             $sites_to_import[] = $site;
         }
     }
     Dataface_JavascriptTool::getInstance()->import('swete/actions/import_webpages/no_settings_id.js');
     df_display(array('sites_to_import' => $sites_to_import), 'swete/actions/import_webpages/no_settings_id.html');
 }
开发者ID:gtoffoli,项目名称:swete,代码行数:13,代码来源:swete_import_webpages.php

示例8: getDataGrids

 function getDataGrids($query = array())
 {
     $app =& Dataface_Application::getInstance();
     $appQuery =& $app->getQuery();
     if (!@$query['tableName']) {
         $query['tableName'] = $appQuery['-table'];
     }
     $grids = df_get_records_array('dataface__DataGrids', $query, null, null, false);
     $out = array();
     foreach ($grids as $grid) {
         $out[] = unserialize($grid->val('gridData'));
     }
     return $out;
 }
开发者ID:promoso,项目名称:HVAC,代码行数:14,代码来源:DataGrid.php

示例9: beforeDelete

 function beforeDelete($record)
 {
     // We need to delete all associated proxy sites.
     $tms = df_get_records_array('directory_profile_translation_memories', array('directory_profile_id' => '=' . $record->val('directory_profile_id')));
     while ($tms) {
         foreach ($tms as $tm) {
             $res = $tm->delete(true);
             if (PEAR::isError($res)) {
                 return PEAR::raiseError('Failed to delete profile site "' . $tm->getTitle(), DATAFACE_E_NOTICE);
             }
         }
         $tms = df_get_records_array('directory_profile_translation_memories', array('directory_profile_id' => '=' . $record->val('directory_profile_id')));
     }
 }
开发者ID:gtoffoli,项目名称:swete,代码行数:14,代码来源:directory_profiles.php

示例10: Dataface_dhtmlxGrid_activegrid

 /**
  * Creates a grid with the given id or a query.
  * @param mixed $query Either the grid id, or a query array.
  *
  */
 function Dataface_dhtmlxGrid_activegrid($query, $name = 'mygrid')
 {
     // We are building a grid from a Dataface Query array.
     $q =& $query;
     if (isset($q['-columns'])) {
         if (is_array($q['-columns'])) {
             $columns = $q['-columns'];
         } else {
             $columns = explode(',', $q['-columns']);
         }
     } else {
         $columns = null;
     }
     if (isset($q['-records'])) {
         $this->Dataface_dhtmlxGrid_grid($columns, $q['-records'], $name, $q['-parent_id'], $q['-relationship']);
     } else {
         if (isset($q['-relationship'])) {
             // We are looking at the related records of a particular record.
             $record = df_get_record($q['-table'], $q);
             $records = $record->getRelatedRecordObjects($q['-relationship']);
             // We want the keys to be unique identifiers for the record that it
             // points to, so we will rekey the array using the
             // Dataface_RelatedRecord::getId() method
             //$related_records = $this->keyById($related_records);
             if (!$columns) {
                 $table =& Dataface_Table::loadTable($q['-table']);
                 $relationship =& $table->getRelationship($q['-relationship']);
                 $columns = $relationship->getColumnNames();
             }
             $this->Dataface_dhtmlxGrid_grid($columns, $records, $name, $record->getId(), $q['-relationship']);
             // now that we have created the grid.. we need to generate
             // and id for it and save the data in session vars
         } else {
             // We are not looking for related records - we are looking for
             // actual records.
             $records = df_get_records_array($q['-table'], $q);
             // We want the keys to be unique identifiers for the record that
             // it points to, so we will rekey the array using the
             // Dataface_Record::getId() method.
             //$records = $this->keyById($records);
             if (!$columns) {
                 $table =& Dataface_Table::loadTable($q['-table']);
                 $columns = $table->fields();
             }
             $this->Dataface_dhtmlxGrid_grid($columns, $records, $name, $q['-table']);
         }
     }
     $this->id = $this->update(null);
 }
开发者ID:promoso,项目名称:HVAC,代码行数:54,代码来源:activegrid.php

示例11: handle

 function handle(&$params)
 {
     @session_write_close();
     $app =& Dataface_Application::getInstance();
     //$out = array();
     $query =& $app->getQuery();
     $records = df_get_records_array($query['-table'], $query);
     header("Content-type: text/html; charset=" . $app->_conf['oe']);
     echo '<option value="">(None)</option>' . "\n";
     foreach ($records as $record) {
         // First lets get the value that we are using for this option
         $value = null;
         if (@$query['-value'] == '__id__') {
             // Use the record id as the value
             $value = $record->getId();
         } else {
             if (@$query['-value']) {
                 // We have an explicitly specified column to use as the key.
                 $value = $record->val($query['-value']);
             } else {
                 if (count($record->_table->keys()) > 1) {
                     // This record has a compound key and no value column was specified
                     // so we use the record id.
                     $value = $record->getId();
                 } else {
                     // This record has a single key column so we return its value
                     $tkeys = $record->_table->keys();
                     $tkeysKeys = array_keys($tkeys);
                     $firstKey = reset($tkeysKeys);
                     $value = $record->val($firstKey);
                 }
             }
         }
         // Now let's get the text that we are using for this option
         $text = null;
         switch (strval(@$query['-text'])) {
             case '':
             case '__title__':
                 $text = $record->getTitle();
                 break;
             default:
                 $text = $record->display($query['-text']);
                 break;
         }
         echo '<option value="' . df_escape($value) . '">' . df_escape($text) . '</option>' . "\n";
     }
     exit;
 }
开发者ID:minger11,项目名称:Pipeline,代码行数:48,代码来源:RecordBrowser_data.php

示例12: beforeDelete

 function beforeDelete($record)
 {
     // We need to delete all associated webpages
     $pages = df_get_records_array('webpages', array('website_id' => '=' . $record->val('website_id')));
     while ($pages) {
         foreach ($pages as $page) {
             $res = $page->delete(true);
             if (PEAR::isError($res)) {
                 return PEAR::raiseError("Failed to delete page " . $page->getTitle(), DATAFACE_E_NOTICE);
             }
         }
         $pages = df_get_records_array('webpages', array('website_id' => '=' . $record->val('website_id')));
     }
     if (class_exists('LiveCache')) {
         LiveCache::touchSite($record->val('website_id'));
     }
 }
开发者ID:gtoffoli,项目名称:swete,代码行数:17,代码来源:websites.php

示例13: handle

 function handle(&$params)
 {
     $app =& Dataface_Application::getInstance();
     $query =& $app->getQuery();
     $nav = array('prev' => array('label' => null, 'url' => null), 'next' => array('label' => null, 'url' => null), 'current' => array('label' => null));
     import('Dataface/Ontology.php');
     Dataface_Ontology::registerType('Event', 'Dataface/Ontology/Event.php', 'Dataface_Ontology_Event');
     $ontology =& Dataface_Ontology::newOntology('Event', $query['-table']);
     $dateAtt = $ontology->getFieldname('date');
     if (PEAR::isError($dateAtt)) {
         die($dateAtt->getMessage());
     }
     if (!isset($query[$dateAtt]) or !preg_match('/^[0-9]{4}-[0-9]{2}-[0-9]{2}\\.\\.[0-9]{4}-[0-9]{2}-[0-9]{2}$/', $query[$dateAtt])) {
         $query[$dateAtt] = date('Y-m-01') . '..' . date('Y-m-t');
     }
     list($startDate) = explode('..', $query[$dateAtt]);
     $startTime = strtotime($startDate);
     $prevMonth = intval(date('m', $startTime)) - 1;
     $nextMonth = intval(date('m', $startTime)) + 1;
     $prevTime = mktime(0, 0, 0, $prevMonth, 1, date('Y', $startTime));
     $nextTime = mktime(0, 0, 0, $nextMonth, 1, date('Y', $startTime));
     $nav['prev']['label'] = date('F Y', $prevTime);
     $nav['prev']['url'] = $app->url('-action=calendar&' . $dateAtt . '=' . urlencode(date('Y-m-01', $prevTime) . '..' . date('Y-m-t', $prevTime)), true, true);
     $nav['next']['label'] = date('F Y', $nextTime);
     $nav['next']['url'] = $app->url('-action=calendar&' . $dateAtt . '=' . urlencode(date('Y-m-01', $nextTime) . '..' . date('Y-m-t', $nextTime)), true, true);
     $nav['current']['label'] = date('F Y', $startTime);
     $query['-limit'] = 500;
     $records =& df_get_records_array($query['-table'], $query);
     $events = array();
     foreach ($records as $record) {
         $event = $ontology->newIndividual($record);
         $datems = strtotime(date('Y-m-d', strtotime($event->strval('date')))) * 1000;
         $timems = (strtotime(date('H:i:s', strtotime($event->strval('start')))) - strtotime(date('Y-m-d'))) * 1000;
         $events[] = array('title' => $record->getTitle(), 'description' => $record->getDescription(), 'date' => $datems + $timems, 'startTime' => strtotime($event->strval('date')) * 1000, 'record_id' => $record->getId());
         unset($event);
         unset($record);
     }
     import('Services/JSON.php');
     $json = new Services_JSON();
     $event_data = 'var events = ' . $json->encode($events);
     import('Dataface/ResultList.php');
     $rs = new Dataface_ResultList($query['-table']);
     df_display(array('event_data' => $event_data, 'nav' => &$nav, 'currentTime' => $startTime, 'filters' => $rs->getResultFilters()), 'Dataface_Calendar.html');
 }
开发者ID:minger11,项目名称:Pipeline,代码行数:44,代码来源:calendar.php

示例14: handle

 function handle(&$params)
 {
     import('Dataface/XMLTool/default.php');
     $xml = new Dataface_XMLTool_default();
     $xml->expanded = true;
     $app =& Dataface_Application::getInstance();
     $query =& $app->getQuery();
     $input = array();
     if (isset($query['--single-record-only'])) {
         $record =& $app->getRecord();
         if ($record->checkPermission('view xml')) {
             $input[] = $record;
         }
     } else {
         if (@$query['-relationship']) {
             $query['-related:limit'] = 9999;
             $query['-related:start'] = 0;
             $record =& $app->getRecord();
             $rrecords =& df_get_related_records($query);
             // $record->getRelatedRecordObjects( $query['-relationship'], 'all' );
             foreach ($rrecords as $rrecord) {
                 $drecord =& $rrecord->toRecord();
                 if ($drecord->checkPermission('view xml')) {
                     $input[] = $drecord;
                 }
                 unset($drecord);
                 unset($rrecord);
             }
         } else {
             $records = df_get_records_array($query['-table'], $query, null, null, false);
             foreach ($records as $record) {
                 if ($record->checkPermission('view xml')) {
                     $input[] = $record;
                 }
             }
         }
     }
     echo $xml->header();
     echo $xml->toXML($input);
     echo $xml->footer();
     exit;
 }
开发者ID:minger11,项目名称:Pipeline,代码行数:42,代码来源:export_xml.php

示例15: handle

 function handle(&$params)
 {
     $app =& Dataface_Application::getInstance();
     $query =& $app->getQuery();
     $records = df_get_selected_records($query);
     if (!$records) {
         if ($query['-mode'] == 'list') {
             $records = df_get_records_array($query['-table'], $query);
         } else {
             $records = array($app->getRecord());
         }
     }
     $out = array();
     if (isset($query['--fields'])) {
         $fields = explode(' ', $query['--fields']);
     } else {
         $fields = null;
     }
     foreach ($records as $record) {
         if (!$record->checkPermission('export_json')) {
             continue;
         }
         if (is_array($fields)) {
             $allowed_fields = array();
             foreach ($fields as $field) {
                 if (!$record->checkPermission('export_json', array('field' => $field))) {
                     continue;
                 }
                 $allowed_fields[] = $field;
             }
         } else {
             $allowed_fields = null;
         }
         $out[] = $record->vals($allowed_fields);
     }
     import('Services/JSON.php');
     $json = new Services_JSON();
     $enc_out = $json->encode($out);
     header('Content-type: application/json; charset=' . $app->_conf['oe']);
     echo $enc_out;
     exit;
 }
开发者ID:promoso,项目名称:HVAC,代码行数:42,代码来源:export_json.php


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