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


PHP DataSource::DataSource方法代码示例

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


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

示例1: DummyDataSource

 function DummyDataSource($pear_db, $storage = 'memory')
 {
     global $CONF, $MODULE;
     $config = array('test' => array('title' => 'Test', 'description' => 'Test table', 'mutable' => TRUE, 'storage' => $storage, 'pear_db' => $pear_db, 'mysql_table' => 'Test_Title', 'query_criteria' => array(array('name' => 'q', 'qs_key' => array('q', 'adv'), 'render_label' => "Search {$MODULE->title} for", 'label' => 'Search for', 'index' => 'default', 'render_default' => $CONF['search_prompt'], 'list' => 'list_search', 'advanced_value_count' => 3, 'is_primary' => TRUE, 'help' => 'enter your search term here'), array('name' => 'text', 'label' => 'Test', 'index' => 'default', 'mode' => QC_MODE_ADVANCED), array('name' => 'category', 'label' => 'Genre', 'type' => QC_TYPE_LIST, 'render_default' => 'Any Genre', 'help' => 'choose your genre'), array('name' => 'date', 'label' => 'Year', 'type' => QC_TYPE_DATE_RANGE, 'range' => array("1900", "1930"), 'add_lists' => TRUE, 'help' => 'select the date range'), array('name' => 'sort', 'label' => 'Sort by', 'type' => QC_TYPE_SORT, 'list' => array('' => 'Date (oldest first)', 'date_desc' => 'Date (newest first)', 'title' => 'Title'), 'is_renderable' => FALSE), array('name' => 'page_size', 'label' => 'Display', 'type' => QC_TYPE_SORT, 'list' => array('10' => '10', '50' => '50', '100' => '100'), 'is_renderable' => FALSE, 'is_encodable' => FALSE, 'default' => 10)), 'query_lists' => array('list_search' => array('' => 'All fields', 'title' => 'Title', 'description' => 'Description', 'person' => 'Contributors', 'keyword' => 'Keywords')), 'fields' => array('url' => array('type' => 'url', 'select' => 'token'), 'title' => array('require' => 1, 'type' => 'varchar', 'size' => '255', 'dc_element' => 'title', 'text_label' => 'Title', 'bibtex_element' => 'title'), 'description' => array('require' => 0, 'type' => 'text', 'dc_element' => 'description', 'text_label' => 'Description', 'bibtex_element' => 'abstract'), 'hidden' => array('type' => 'integer', 'default' => 0), 'restricted' => array('type' => 'integer', 'default' => 0), 'media' => array('type' => 'one_to_many', 'foreign_key' => 'title_id', 'select' => 'title,location,content_type,size'), 'person' => array('type' => 'many_to_many', 'link' => 'Test_Participation', 'select' => 'name, name as title', 'join' => 'JOIN Test_Participation ON Test_Participation.person_id=Test_Person.id', 'keys' => array('title_id', 'person_id')), 'keyword' => array('type' => 'many_to_many', 'link' => 'Test_TitleKeyword', 'select' => 'title', 'join' => 'JOIN Test_TitleKeyword ON Test_TitleKeyword.keyword_id=Test_Keyword.id', 'keys' => array('title_id', 'keyword_id'), 'get' => 'col')), 'search' => array('fields' => array('t.title', 't.description AS summary'), 'index' => array('default' => array('type' => 'fulltext', 'fields' => 't.title,t.description'), 'title' => array('type' => 'fulltext', 'fields' => 't.title'), 'sort.title' => array('type' => 'asc', 'fields' => 't.title')))), 'media' => array('slug' => 'title', 'title' => 'Media', 'description' => 'Media files', 'mutable' => TRUE, 'storage' => $storage, 'mysql_table' => 'Test_Media', 'fields' => array('title' => array('require' => 1, 'type' => 'varchar', 'size' => '255'), 'location' => array('require' => 1, 'type' => 'varchar', 'size' => '255'), 'content_type' => array('type' => 'varchar', 'size' => '100'), 'size' => array('type' => 'integer'), 'title_id' => array('type' => 'integer'))), 'person' => array('slug' => 'name', 'title' => 'Person', 'description' => 'Real People', 'mutable' => TRUE, 'storage' => $storage, 'mysql_table' => 'Test_Person', 'fields' => array('name' => array('require' => 1, 'type' => 'varchar', 'size' => '255'))), 'keyword' => array('slug' => 'title', 'title' => 'Keywords', 'description' => 'Search enhancers. Non-controlled vocabulary.', 'mutable' => TRUE, 'storage' => $storage, 'mysql_table' => 'Test_Keyword', 'fields' => array('url' => array('type' => 'url', 'select' => 'id'), 'title' => array('require' => 1, 'type' => 'varchar', 'size' => '255'))), 'test2' => array('title' => 'Test 2', 'description' => 'Another test table', 'mutable' => TRUE, 'storage' => 'memory', 'fields' => array('title' => array('require' => 1), 'description' => array('require' => 0)), 'query_criteria' => array(array('name' => 'q', 'qs_key' => array('q', 'adv'), 'label' => 'Search for', 'index' => 'default', 'render_default' => $CONF['search_prompt'], 'list' => 'list_search', 'advanced_value_count' => 3, 'is_primary' => TRUE, 'help' => 'enter your search term here'))), 'test3' => array('title' => 'Test 3', 'description' => 'Another test table', 'mutable' => FALSE, 'storage' => 'memory', 'fields' => array('title' => array('require' => 1), 'description' => array('require' => 0))), 'listings' => array('title' => '', 'description' => '', 'mutable' => TRUE, 'storage' => 'mysql', 'mysql_table' => 'Test_Broadcast', 'query_criteria' => array(array('name' => 'date', 'type' => QC_TYPE_DATE_RANGE, 'range' => array('2001-09-07', date('Y-m-d') + 1), 'default' => array(date('Y-m-d'), date('Y-m-d') + 1)), array('name' => 'time', 'type' => QC_TYPE_LIST, 'default' => date('G'), 'is_renderable' => FALSE, 'is_encodable' => FALSE), array('name' => 'channel', 'label' => 'Channel', 'type' => QC_TYPE_FLAG, 'list' => array('1' => 'Test', '54' => 'BBC1 London', '68' => 'BBC2 London', '175' => 'ITV1 London', '106' => 'Channel 4', '138' => 'Five'), 'default' => array(54 => 1, 68 => 1, 175 => 1, 106 => 1, 138 => 1)), array('name' => 'style', 'type' => QC_TYPE_OPTION, 'list' => array('list', 'grid'), 'default' => 'list', 'is_renderable' => FALSE, 'is_encodable' => FALSE), array('name' => 'view_grid', 'type' => QC_TYPE_FLAG, 'is_renderable' => FALSE, 'is_encodable' => FALSE), array('name' => 'view_list', 'type' => QC_TYPE_FLAG, 'is_renderable' => FALSE, 'is_encodable' => FALSE), array('name' => 'page_size', 'type' => QC_TYPE_SORT, 'is_renderable' => FALSE, 'is_encodable' => FALSE, 'default' => 1000)), 'fields' => array('url' => array('type' => 'url', 'select' => 'id'), 'date' => array('require' => 1, 'type' => 'timestamp'), 'end_date' => array('require' => 1, 'type' => 'timestamp'), 'bds_id' => array('type' => 'varchar', 'size' => '255'), 'prog_id' => array('require' => 1, 'type' => 'integer'), 'channel' => array('type' => 'many_to_many', 'link' => 'Test_BroadcastChannel', 'select' => 'name,id AS `key`', 'keys' => array('bcast_id', 'channel_id'), 'lookup' => 'name')), 'search' => array('fields' => array("t.date,t.end_date,t.id,c.name AS channel,c.id AS channel_id," . "p.title,p.bds_id AS prog_bds_id,p.is_highlighted," . "TIME_TO_SEC(TIMEDIFF(t.end_date, t.date))+1 AS duration"), 'index' => array('join' => array('JOIN Test_Programme p ON p.id=t.prog_id', 'JOIN Test_BroadcastChannel bc ON bc.bcast_id=t.id', 'JOIN Test_Channel c ON c.id=bc.channel_id'), 'default' => array('type' => 'datetime', 'fields' => 't.date'), 'channel' => array('type' => 'number', 'fields' => 'bc.channel_id'), 'date' => array('type' => 'datetime', 'fields' => 't.date'), 'sort.date_asc' => array('type' => 'asc', 'fields' => 't.date'), 'sort.date_desc' => array('type' => 'desc', 'fields' => 't.date'), 'sort.default' => array('type' => 'asc', 'fields' => 't.date')))), 'channel' => array('title' => 'Channels', 'description' => '', 'mutable' => TRUE, 'storage' => 'mysql', 'mysql_table' => 'Test_Channel', 'fields' => array('url' => array('type' => 'url', 'select' => 'id'), 'name' => array('require' => 1, 'type' => 'varchar', 'size' => '255')), 'search' => array('fields' => array("t.name AS title,id AS `key`"))));
     DataSource::DataSource($config);
     $this->add_mock_data();
 }
开发者ID:bufvc,项目名称:bufvc-potnia-framework,代码行数:7,代码来源:DummyDataSource.class.php

示例2: FormatterDataSource

 function FormatterDataSource()
 {
     $config = array('test' => array('title' => 'Test', 'summary' => 'Test table', 'mutable' => TRUE, 'storage' => 'memory', 'fields' => array('title' => array('require' => 1, 'dc_element' => 'title', 'text_label' => 'Title', 'bibtex_element' => 'title', 'atom_element' => 'title', 'ical_element' => 'summary'), 'summary' => array('dc_element' => 'description', 'text_label' => 'Description', 'bibtex_element' => 'abstract', 'atom_element' => 'summary', 'ical_element' => 'description'), 'files' => array(), 'keywords' => array('dc_element' => 'subject', 'text_label' => 'Keywords', 'bibtex_element' => 'keywords', 'ical_element' => 'categories'), 'category' => array('dc_element' => 'subject', 'text_label' => 'Genre', 'bibtex_element' => 'keywords'), 'people' => array('bibtex_element' => 'author', 'atom_element' => 'contributor'), 'double_array' => array('dc_element' => 'double_array', 'text_label' => 'Double array', 'bibtex_element' => 'double_array', 'atom_element' => 'double_array'), 'location' => array('atom_element' => 'link'), 'date' => array('ical_element' => 'dtstart', 'ical_element_config' => array('description' => 'Second description')), 'date2' => array('ical_element' => 'dtstart', 'ical_element_config' => array('dtend' => 'end_date')), 'end_date' => array()), 'dc_element_static' => array('creator' => 'Invocrown Ltd'), 'dc_element_extras' => array('location' => 'new_label'), 'bibtex_element_static' => array('publisher' => 'Invocrown Ltd'), 'bibtex_element_extras' => array('location' => 'new_label'), 'text_label_static' => array('Additional' => 'some other data'), 'text_label_extras' => array('location' => 'New label'), 'ical_element_static' => array('comment' => 'Invocrown Ltd'), 'ical_element_extras' => array('location' => 'location')));
     DataSource::DataSource($config);
     $this->add_mock_data();
 }
开发者ID:bufvc,项目名称:bufvc-potnia-framework,代码行数:6,代码来源:testFormatter.php

示例3: PersistenceMgr

 /**
  * Creates a new instance.
  *
  * @param $username the username
  * @param $settings an instance of the settings object.
  */
 function PersistenceMgr($username, &$settings)
 {
     DataSource::DataSource($username, $settings);
 }
开发者ID:simonmikkelsen,项目名称:zipstat,代码行数:10,代码来源:Html.php


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