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


PHP df_get_record函数代码示例

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


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

示例1: handle

 function handle(&$params)
 {
     // mark the message as read, if hasn't been read yet -job_note_id
     try {
         $app = Dataface_Application::getInstance();
         $query = $app->getQuery();
         $auth =& Dataface_AuthenticationTool::getInstance();
         $user =& $auth->getLoggedInUser();
         $note_id = $query['-job_note_id'];
         $jobNote =& df_get_record("job_notes", array('JobNoteId' => $note_id));
         $job =& df_get_record("jobs", array('job_id' => $jobNote->val('job_id')));
         if (!$job->checkPermission('read message')) {
             throw new Exception("You do not have permission to read this note", E_USER_ERROR);
         }
         require_once 'inc/SweteDb.class.php';
         require_once 'inc/SweteJobInbox.class.php';
         SweteJobInbox::setReadStatic($note_id, $user->val('username'));
     } catch (Exception $e) {
         if ($e->getCode() == E_USER_ERROR) {
             echo $e->getMessage();
         } else {
             throw $e;
         }
     }
 }
开发者ID:gtoffoli,项目名称:swete,代码行数:25,代码来源:swete_message_read.php

示例2: field__webpage

 function field__webpage($record)
 {
     if (!isset($record->pouch['webpage'])) {
         $record->pouch['webpage'] = df_get_record('webpages', array('webpage_id' => '=' . $record->val('webpage_id')));
     }
     return $record->pouch['webpage'];
 }
开发者ID:gtoffoli,项目名称:swete,代码行数:7,代码来源:webpage_properties.php

示例3: handle

 function handle(&$params)
 {
     try {
         // add a new message to the current job record
         //-content is the new message content
         $app = Dataface_Application::getInstance();
         $query = $app->getQuery();
         $auth =& Dataface_AuthenticationTool::getInstance();
         $user =& $auth->getLoggedInUser();
         $content = trim(htmlspecialchars($query['-content']));
         if (!$content) {
             throw new Exception("No message contents entered.", E_USER_ERROR);
         }
         $job_id = $query['-job_id'];
         $job_rec =& df_get_record("jobs", array('job_id' => $job_id));
         if (!$job_rec->checkPermission('add new related record')) {
             throw new Exception("You do not have permission to add a note to this job.", E_USER_ERROR);
         }
         require_once 'inc/SweteDb.class.php';
         require_once 'inc/SweteJob.class.php';
         require_once 'inc/SweteJobInbox.class.php';
         $job = new SweteJob($job_rec);
         $inbox = $job->getInbox($user->val('username'));
         $noteRec = $inbox->addMessage($content);
     } catch (Exception $e) {
         if ($e->getCode() == E_USER_ERROR) {
             echo $e->getMessage();
         } else {
             throw $e;
         }
     }
 }
开发者ID:gtoffoli,项目名称:swete,代码行数:32,代码来源:swete_message_add.php

示例4: handle

 function handle($params)
 {
     session_write_close();
     header('Connection:close');
     $app = Dataface_Application::getInstance();
     $query = $app->getQuery();
     if (@$query['--id']) {
         $table = Dataface_Table::loadTable($query['-table']);
         $keys = array_keys($table->keys());
         if (count($keys) > 1) {
             throw new Exception("Table has compound key so its permissions cannot be retrieved with the --id parameter.");
         }
         $query[$keys[0]] = '=' . $query['--id'];
         $record = df_get_record($query['-table'], $query);
     } else {
         $record = $app->getRecord();
     }
     $perms = array();
     if ($record) {
         $perms = $record->getPermissions();
     }
     header('Content-type: application/json; charset="' . $app->_conf['oe'] . '"');
     $out = json_encode($perms);
     header('Content-Length: ' . strlen($out));
     echo $out;
     flush();
 }
开发者ID:minger11,项目名称:Pipeline,代码行数:27,代码来源:ajax_get_permissions.php

示例5: 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

示例6: handle

 function handle(&$params)
 {
     try {
         $app = Dataface_Application::getInstance();
         $query = $app->getQuery();
         $jobRecord = df_get_record('jobs', array('job_id' => '=' . $query['-job_id']));
         if (!$jobRecord->checkPermission('edit')) {
             throw new Exception("You do not have permission make changes to this translation job.", E_USER_ERROR);
         }
         $job = new SweteJob($jobRecord);
         if (array_key_exists('-webpage_id', $query)) {
             $webpageRecord = df_get_record('webpages', array('webpage_id' => '=' . $query['-webpage_id']));
             $webpage = new SweteWebpage($webpageRecord);
             $job->removeWebpage($webpage);
         } else {
             if (array_key_exists('-data-http-request-log-id', $query)) {
                 $job->removeRequestStrings($query['-data-http-request-log-id']);
             }
         }
     } catch (Exception $e) {
         if ($e->getCode() == E_USER_ERROR) {
             echo $e->getMessage();
         } else {
             throw $e;
         }
     }
 }
开发者ID:gtoffoli,项目名称:swete,代码行数:27,代码来源:swete_remove_webpage_from_job.php

示例7: field__website

 function field__website($record)
 {
     $webpage = df_get_record('webpages', array('webpage_id' => '=' . $record->val('webpage_id')));
     if (!$webpage) {
         return null;
     }
     return df_get_record('websites', array('website_id' => '=' . $webpage->val('website_id')));
 }
开发者ID:gtoffoli,项目名称:swete,代码行数:8,代码来源:job_translatable.php

示例8: test_testCondition

 function test_testCondition()
 {
     require_once 'dataface-public-api.php';
     $record =& df_get_record('People', array('PersonID' => 1));
     $it =& $record->getRelationshipIterator('Publications');
     $pub =& $it->next();
     $this->assertTrue($pub->testCondition('$PublicationID == 1'));
     $this->assertTrue($pub->testCondition('$PubType == "Refereed Journal"'));
     $this->assertTrue(!$pub->testCondition('$PubType == "Journal"'));
 }
开发者ID:Zunair,项目名称:xataface,代码行数:10,代码来源:RelatedRecordTest.php

示例9: test_groupBy

 function test_groupBy()
 {
     $record =& df_get_record('People', array('PersonID' => 1));
     $pubs = $record->getRelatedRecords('Publications', 'all');
     $categories = Dataface_Utilities::groupBy('PubType', $pubs);
     $this->assertEquals(array('Refereed Journal', 'Book Chapter', 'Conference'), array_keys($categories));
     $this->assertEquals(64, sizeof($categories['Refereed Journal']));
     $this->assertEquals(64, sizeof($categories['Book Chapter']));
     $this->assertEquals(63, sizeof($categories['Conference']));
 }
开发者ID:Zunair,项目名称:xataface,代码行数:10,代码来源:UtilitiesTest.php

示例10: handleGet_settingsNotFound

 function handleGet_settingsNotFound($params)
 {
     $website_id = $params['website_id'];
     $settings = df_get_record('websites', array('website_id' => '=' . $website_id));
     if (!$settings) {
         df_display(array(), 'swete/actions/import_webpages/no_settings_found.html');
         return;
     } else {
         df_display(array('settings' => $settings), 'swete/actions/import_webpages/settings_site_not_found.html');
     }
 }
开发者ID:gtoffoli,项目名称:swete,代码行数:11,代码来源:swete_import_webpages.php

示例11: handle

 function handle($params)
 {
     session_write_close();
     header('Connection: close');
     $app = Dataface_Application::getInstance();
     $query = $app->getQuery();
     if (!@$query['-job_translatable_id']) {
         throw new Exception("No translatable id specified");
     }
     $translatable = df_get_record('job_translatable', array('job_translatable_id' => '=' . $query['-job_translatable_id']));
     if (!$translatable) {
         throw new Exception("Translatable could not be found.");
     }
     $job = df_get_record('jobs', array('job_id' => '=' . $translatable->val('job_id')));
     if (!$job) {
         throw new Exception("Job could not be loaded.");
     }
     if (!$job->checkPermission('preview job')) {
         header('HTTP/1.0 401 Forbidden');
         exit;
     }
     require_once 'inc/SweteJob.class.php';
     require_once 'inc/SweteJobPageSucker.php';
     $jobO = new SweteJob($job);
     $pageSucker = new SweteJobPageSucker($jobO);
     $translation = "source";
     if (@$query['-translation']) {
         $translation = $query['-translation'];
     }
     if ($translation == "source") {
         $output = $translatable->val('full_contents');
         $output = $pageSucker->renderHtml($output, DATAFACE_SITE_HREF . '?-action=swete_job_serve_content&job_id=' . $job->val('job_id') . '&url_hash=');
         //$output = $jobO->translateHtml($output, unserialize($job->val('previous_translations')));
     } else {
         if ($translation == "previous") {
             $output = $translatable->val('full_contents');
             $output = $pageSucker->renderHtml($output, DATAFACE_SITE_HREF . '?-action=swete_job_serve_content&job_id=' . $job->val('job_id') . '&url_hash=');
             $output = $jobO->translatePreviousHtml($output, unserialize($job->val('previous_translations')));
         } else {
             if ($translation == "new") {
                 $output = $translatable->val('full_contents');
                 $output = $pageSucker->renderHtml($output, DATAFACE_SITE_HREF . '?-action=swete_job_serve_content&job_id=' . $job->val('job_id') . '&url_hash=');
                 $output = $jobO->translateHtml($output, unserialize($job->val('previous_translations')));
             } else {
                 throw new Exception("Invalid translation parameter " . $translation);
             }
         }
     }
     header('Content-Length: ' . strlen($output));
     header('Content-type: text/html; charset="UTF-8"');
     echo $output;
 }
开发者ID:gtoffoli,项目名称:swete,代码行数:52,代码来源:swete_preview_job_page.php

示例12: 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

示例13: setUp

 function setUp()
 {
     parent::setUp();
     xf_db_query("CREATE TABLE `Pages` (\n\t\t\t`PageID` INT(11) auto_increment NOT NULL,\n\t\t\t`ParentID` INT(11),\n\t\t\t`ShortName` VARCHAR(32) NOT NULL,\n\t\t\t`Description` TEXT,\n\t\t\tPRIMARY KEY (`PageID`),\n\t\t\tUNIQUE (`ParentID`,`ShortName`))") or trigger_error(xf_db_error() . __LINE__);
     xf_db_query("INSERT INTO `Pages` (`PageID`,`ShortName`,`Description`)\n\t\t\tVALUES (1,'index_page','Main page')") or trigger_error(xf_db_error() . __LINE__);
     xf_db_query("INSERT INTO `Pages` (`ParentID`,`ShortName`,`Description`)\n\t\t\tVALUES \n\t\t\t(1,'about','About us'),\n\t\t\t(1,'jobs','Now hiring'),\n\t\t\t(1,'products','About our products'),\n\t\t\t(1,'services','About our services'),\n\t\t\t(1,'contact','Contact us')") or trigger_error(xf_db_error() . __LINE__);
     xf_db_query("INSERT INTO `Pages` (`ParentID`,`ShortName`,`Description`)\n\t\t\tVALUES\n\t\t\t(2,'history','Our history'),\n\t\t\t(2,'future', 'The direction of the company'),\n\t\t\t(3,'application', 'Job application'),\n\t\t\t(3,'current_listing', 'Current job listings'),\n\t\t\t(4,'awards','Product awards'),\n\t\t\t(4,'downloads','Product downlaods'),\n\t\t\t(5,'consultation','Free consultation')") or trigger_error(xf_db_error() . __LINE__);
     $table =& Dataface_Table::loadTable('Pages');
     $r =& $table->relationships();
     if (!isset($r['children'])) {
         $table->addRelationship('children', array('__sql__' => 'select * from Pages where ParentID=\'$PageID\'', 'meta:class' => 'children'));
     }
     $this->indexpage =& df_get_record('Pages', array('PageID' => 1));
     $this->t = new Dataface_TreeTable($this->indexpage);
 }
开发者ID:Zunair,项目名称:xataface,代码行数:15,代码来源:TreeTableTest.php

示例14: handle

 function handle($params)
 {
     $app = Dataface_Application::getInstance();
     $query = $app->getQuery();
     $website = df_get_record('websites', array('website_id' => '=' . $query['website_id']));
     if (!$website) {
         throw new Exception("Website could not be found.");
     }
     if (!$website->checkPermission('capture strings')) {
         return Dataface_Error::permissionDenied("You don't have permission to perform this action.");
     }
     Dataface_JavascriptTool::getInstance()->import('swete/actions/swete_tool_bar.js');
     import('inc/SweteSite.class.php');
     df_display(array('website' => $website, 'websiteWrapper' => new SweteSite($website)), 'swete/actions/toolbar_wrapper.html');
 }
开发者ID:gtoffoli,项目名称:swete,代码行数:15,代码来源:swete_tool_bar.php

示例15: handle

 function handle(&$params)
 {
     // returns html for a table with all the messages for -job_id
     $app = Dataface_Application::getInstance();
     $query = $app->getQuery();
     $auth =& Dataface_AuthenticationTool::getInstance();
     $user =& $auth->getLoggedInUser();
     $job_id = $query['-job_id'];
     $job =& df_get_record("jobs", array('job_id' => $job_id));
     require_once 'inc/SweteDb.class.php';
     require_once 'inc/SweteJob.class.php';
     require_once 'inc/SweteJobInbox.class.php';
     require_once 'inc/SweteJobInboxPresentation.php';
     $sweteJob = new SweteJob($job);
     $messageList = $sweteJob->getInbox($user->val('username'))->getMessageList();
     echo SweteJobInboxPresentation::tableContent($messageList);
 }
开发者ID:gtoffoli,项目名称:swete,代码行数:17,代码来源:swete_messages.php


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