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


PHP Dataface_Table::loadTable方法代码示例

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


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

示例1: handle

 function handle(&$params)
 {
     $app =& Dataface_Application::getInstance();
     if (!@$_POST['-valuelist']) {
         echo JSON::error("No valuelist specified.");
         exit;
     }
     $valuelist = $_POST['-valuelist'];
     $query =& $app->getQuery();
     $table =& Dataface_Table::loadTable($query['-table']);
     if (!@$_POST['-value']) {
         echo JSON::error("No value was provided to be appended to the valuelist.");
         exit;
     }
     $value = $_POST['-value'];
     if (@$_POST['-key']) {
         $key = $_POST['-key'];
     } else {
         $key = null;
     }
     $vt =& Dataface_ValuelistTool::getInstance();
     $res = $vt->addValueToValuelist($table, $valuelist, $value, $key, true);
     if (PEAR::isError($res)) {
         echo JSON::error($res->getMessage());
         exit;
     }
     echo JSON::json(array('success' => 1, 'value' => array('key' => $res['key'], 'value' => $res['value'])));
     exit;
 }
开发者ID:minger11,项目名称:Pipeline,代码行数:29,代码来源:ajax_valuelist_append.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)
 {
     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

示例4: Dataface_ValuelistEditorForm

 function Dataface_ValuelistEditorForm($tablename, $valuelistName, $widgetID = null)
 {
     $this->table =& Dataface_Table::loadTable($tablename);
     $this->valuelistName = $valuelistName;
     $this->values = $this->table->getValuelist($this->valuelistName);
     $this->widgetID = $widgetID;
 }
开发者ID:minger11,项目名称:Pipeline,代码行数:7,代码来源:ValuelistEditorForm.php

示例5: __construct

    /**
     * @brief Initializes the datepicker module and registers all of the event listener.
     *
     */
    function __construct()
    {
        $app = Dataface_Application::getInstance();
        // Now work on our dependencies
        $mt = Dataface_ModuleTool::getInstance();
        // We require the XataJax module
        // The XataJax module activates and embeds the Javascript and CSS tools
        $mt->loadModule('modules_XataJax', 'modules/XataJax/XataJax.php');
        // Register the geopicker widget with the form tool so that it responds
        // to widget:type=geopicker
        import('Dataface/FormTool.php');
        $ft = Dataface_FormTool::getInstance();
        $ft->registerWidgetHandler('geopicker', dirname(__FILE__) . DIRECTORY_SEPARATOR . 'widget.php', 'Dataface_FormTool_geopicker');
        if (!@$app->_conf['modules_geopicker'] or !@$app->_conf['modules_geopicker']['key']) {
            $msg = <<<END
                 <p>Google Maps Module is installed but no API key is specified.</p>
                 <p>For information about obtaining your API key see <a href="https://developers.google.com/maps/documentation/javascript/tutorial#api_key">this page</a>.</p>
                 <p>After obtaining your key, add the following section to your application's conf.ini file:</p>
                 <p><code><pre>
[modules_geopicker]
    key=YOUR_API_KEY_HERE
                    </pre></code></p>
END;
            die($msg);
        }
        $app->addHeadContent('<script>XF_GEOPICKER_API_KEY="' . htmlspecialchars($app->_conf['modules_geopicker']['key']) . '";</script>');
        foreach (Dataface_Table::loadTable('', df_db(), true) as $t) {
            $evt = new StdClass();
            $evt->table = $t;
            $this->afterTableInit($evt);
        }
        $app->registerEventListener("afterTableInit", array($this, 'afterTableInit'));
        $app->registerEventListener("Dataface_Record__htmlValue", array($this, 'Dataface_Record__htmlValue'));
    }
开发者ID:arkypita,项目名称:xataface-modules-geopicker,代码行数:38,代码来源:geopicker.php

示例6: handle

 function handle($params)
 {
     $app =& Dataface_Application::getInstance();
     $query =& $app->getQuery();
     if (!isset($query['-relationship'])) {
         return PEAR::raiseError("No relationship specified.");
     }
     $table =& Dataface_Table::loadTable($query['-table']);
     $record =& $app->getRecord();
     if (!$record) {
         return Dataface_Error::permissionDenied("No record found");
     }
     $perms = $record->getPermissions(array('relationship' => $query['-relationship']));
     if (!@$perms['view related records']) {
         return Dataface_Error::permissionDenied('You don\'t have permission to view this relationship.');
     }
     $action = $table->getRelationshipsAsActions(array(), $query['-relationship']);
     if (isset($query['-template'])) {
         df_display(array('record' => $record), $query['-template']);
     } else {
         if (isset($action['template'])) {
             df_display(array('record' => $record), $action['template']);
         } else {
             df_display(array('record' => $record), 'Dataface_Related_Records_List.html');
         }
     }
 }
开发者ID:minger11,项目名称:Pipeline,代码行数:27,代码来源:related_records_list.php

示例7: handle

 function handle($params)
 {
     $app =& Dataface_Application::getInstance();
     $query =& $app->getQuery();
     $record =& $app->getRecord();
     if (!$record) {
         return PEAR::raiseError("No record found.", DATAFACE_E_NOTICE);
     }
     if (!isset($query['-relationship'])) {
         return PEAR::raiseError("No relationship specified.");
     }
     $table =& Dataface_Table::loadTable($query['-table']);
     $action = $table->getRelationshipsAsActions(array(), $query['-relationship']);
     if (@$action['permission'] and !$record->checkPermission($action['permission'])) {
         return Dataface_Error::permissionDenied();
     }
     ob_start();
     import('Dataface/RelationshipCheckboxForm.php');
     $form = new Dataface_RelationshipCheckboxForm($record, $query['-relationship']);
     $out = ob_get_contents();
     ob_end_clean();
     if (isset($query['-template'])) {
         df_display(array('form' => $out), $query['-template']);
     } else {
         if (isset($action['template'])) {
             df_display(array('form' => $out), $action['template']);
         } else {
             df_display(array('form' => $out), 'Dataface_related_records_checkboxes.html');
         }
     }
 }
开发者ID:minger11,项目名称:Pipeline,代码行数:31,代码来源:related_records_checkboxes.php

示例8: handle2

 function handle2($params)
 {
     $app = Dataface_Application::getInstance();
     $query = $app->getQuery();
     $table = $query['-table'];
     if (!@$query['-field']) {
         throw new Exception("No field specified", 500);
     }
     if (!@$query['-key']) {
         throw new Exception("No key specified", 500);
     }
     $tableObj = Dataface_Table::loadTable($table);
     if (PEAR::isError($tableObj)) {
         throw new Exception($tableObj->getMessage(), $tableObj->getCode());
     }
     $field =& $tableObj->getField($query['-field']);
     if (PEAR::isError($field)) {
         throw new Exception("Field not found " . $field->getMessage(), $field->getCode());
     }
     if (!@$field['vocabulary']) {
         throw new Exception("Field has no vocabulary assigned", 500);
     }
     $perms = $tableObj->getPermissions(array('field' => $field['name']));
     if (!@$perms['edit'] && !@$perms['new']) {
         throw new Exception("You don't have permission to access this vocabulary.", 400);
     }
     $valuelist = $tableObj->getValuelist($field['vocabulary']);
     if (PEAR::isError($valuelist)) {
         throw new Exception("Valuelist not found.", 404);
     }
     $value = @$valuelist[$query['-key']];
     df_write_json(array('code' => 200, 'message' => 'Found', 'value' => $value));
 }
开发者ID:minger11,项目名称:Pipeline,代码行数:33,代码来源:field_vocab_value.php

示例9: ReferenceBrowser

 function ReferenceBrowser($tablename, $relationshipName)
 {
     $this->_table =& Dataface_Table::loadTable($tablename);
     $this->_relationshipName = $relationshipName;
     $this->_relationship =& $this->_table->getRelationship($relationshipName);
     $this->HTML_QuickForm('Reference Browser');
 }
开发者ID:promoso,项目名称:HVAC,代码行数:7,代码来源:ReferenceBrowser.php

示例10: test_add_value

 function test_add_value()
 {
     $vt = Dataface_ValuelistTool::getInstance();
     $people = Dataface_Table::loadTable('People');
     $vt->addValueToValuelist($people, 'Publications', 'My Test Publication');
     $res = xf_db_query("select * from Publications where `BiblioString` = 'My Test Publication'");
     $this->assertTrue(xf_db_num_rows($res) === 1);
 }
开发者ID:Zunair,项目名称:xataface,代码行数:8,代码来源:ValuelistToolTest.php

示例11: handle

 function handle(&$params)
 {
     $app =& Dataface_Application::getInstance();
     $query =& $app->getQuery();
     $this->table =& Dataface_Table::loadTable($query['-table']);
     $translations =& $this->table->getTranslations();
     foreach (array_keys($translations) as $trans) {
         $this->table->getTranslation($trans);
     }
     //print_r($translations);
     if (!isset($translations) || count($translations) < 2) {
         // there are no translations to be made
         trigger_error('Attempt to translate a record in a table "' . $this->table->tablename . '" that contains no translations.', E_USER_ERROR);
     }
     $this->translatableLanguages = array_keys($translations);
     $translatableLanguages =& $this->translatableLanguages;
     $this->languageCodes = new I18Nv2_Language($app->_conf['lang']);
     $languageCodes =& $this->languageCodes;
     $currentLanguage = $languageCodes->getName($app->_conf['lang']);
     if (count($translatableLanguages) < 2) {
         return PEAR::raiseError(df_translate('Not enough languages to translate', 'There aren\'t enough languages available to translate.'), DATAFACE_E_ERROR);
     }
     //$defaultSource = $translatableLanguages[0];
     //$defaultDest = $translatableLanguages[1];
     $options = array();
     foreach ($translatableLanguages as $lang) {
         $options[$lang] = $languageCodes->getName($lang);
     }
     unset($options[$app->_conf['default_language']]);
     $tt = new Dataface_TranslationTool();
     $form = new HTML_QuickForm('StatusForm', 'POST');
     $form->addElement('select', '--language', 'Translation', $options);
     $form->addElement('select', '--status', 'Status', $tt->translation_status_codes);
     //$form->setDefaults( array('-sourceLanguage'=>$defaultSource, '-destinationLanguage'=>$defaultDest));
     $form->addElement('submit', '--set_status', 'Set Status');
     foreach ($query as $key => $value) {
         $form->addElement('hidden', $key);
         $form->setDefaults(array($key => $value));
     }
     if ($form->validate()) {
         $res = $form->process(array(&$this, 'processForm'));
         if (PEAR::isError($res)) {
             return $res;
         } else {
             header('Location: ' . $app->url('-action=list&-sourceLanguage=&-destinationLanguage=&-translate=') . '&--msg=' . urlencode('Translation status successfully set.'));
             exit;
         }
     }
     ob_start();
     $form->display();
     $out = ob_get_contents();
     ob_end_clean();
     $records =& $this->getRecords();
     df_display(array('form' => $out, 'translationTool' => &$tt, 'records' => &$records, 'translations' => &$options, 'context' => &$this), 'Dataface_set_translation_status.html');
 }
开发者ID:promoso,项目名称:HVAC,代码行数:55,代码来源:set_translation_status.php

示例12: array

 /**
  * Defines how a depselect widget should be built.
  *
  * @param Dataface_Record $record The Dataface_Record that is being edited.
  * @param array &$field The field configuration data structure that the widget is being generated for.
  * @param HTML_QuickForm The form to which the field is to be added.
  * @param string $formFieldName The name of the field in the form.
  * @param boolean $new Whether this widget is being built for a new record form.
  * @return HTML_QuickForm_element The element that can be added to a form.
  *
  */
 function &buildWidget(&$record, &$field, &$form, $formFieldName, $new = false)
 {
     $factory = Dataface_FormTool::factory();
     $mt = Dataface_ModuleTool::getInstance();
     $mod = $mt->loadModule('modules_depselect');
     //$atts = $el->getAttributes();
     $widget =& $field['widget'];
     $atts = array();
     if (!@$atts['class']) {
         $atts['class'] = '';
     }
     $atts['class'] .= ' xf-depselect';
     if (!@$atts['data-xf-table']) {
         $atts['data-xf-table'] = $field['tablename'];
     }
     $targetTable = Dataface_Table::loadTable($field['widget']['table']);
     if (PEAR::isError($targetTable)) {
         error_log("Your field {$formFieldName} is missing the widget:table directive or the table does not exist.");
         throw new Exception("Your field {$formFieldName} is missing the widget:table directive or the table does not exist.");
     }
     $targetPerms = $targetTable->getPermissions();
     $atts['data-xf-depselect-options-table'] = $field['widget']['table'];
     if (@$targetPerms['new']) {
         $atts['data-xf-depselect-perms-new'] = 1;
     }
     $atts['df:cloneable'] = 1;
     $jt = Dataface_JavascriptTool::getInstance();
     $jt->addPath(dirname(__FILE__) . '/js', $mod->getBaseURL() . '/js');
     $ct = Dataface_CSSTool::getInstance();
     $ct->addPath(dirname(__FILE__) . '/css', $mod->getBaseURL() . '/css');
     // Add our javascript
     $jt->import('xataface/widgets/depselect.js');
     $filters = array();
     if (@$field['widget']['filters'] and is_array($field['widget']['filters'])) {
         foreach ($field['widget']['filters'] as $key => $val) {
             $filters[] = urlencode($key) . '=' . urlencode($val);
         }
     }
     $atts['data-xf-depselect-filters'] = implode('&', $filters);
     if (@$field['widget']['nomatch']) {
         $atts['data-xf-depselect-nomatch'] = $field['widget']['nomatch'];
     }
     if (@$field['widget']['dialogSize']) {
         $atts['data-xf-depselect-dialogSize'] = $field['widget']['dialogSize'];
     }
     if (@$field['widget']['dialogMargin']) {
         $atts['data-xf-depselect-dialogMargin'] = $field['widget']['dialogMargin'];
     }
     //$el->setAttributes($atts);
     $el = $factory->addElement('depselect', $formFieldName, $widget['label'], $atts);
     if (PEAR::isError($el)) {
         throw new Exception($el->getMessage(), $el->getCode());
     }
     return $el;
 }
开发者ID:shannah,项目名称:xataface-module-depselect,代码行数:66,代码来源:widget.php

示例13: test_table_permissions

 function test_table_permissions()
 {
     $pt =& Dataface_PermissionsTool::getInstance();
     $perms = $pt->getPermissions(Dataface_Table::loadTable('Profiles'));
     $this->assertEquals(array(1, 1, 1), array($perms['view'], $perms['edit'], $perms['delete']));
     $perms = $pt->getPermissions(Dataface_Table::loadTable('Profiles'), array('field' => 'fname'));
     $this->assertEquals(array(1, 1, 1), array($perms['view'], $perms['edit'], $perms['delete']));
     // varcharfield_checkboxes has view disabled in the fields.ini file
     $this->assertTrue(!$pt->view(Dataface_Table::loadTable('Test'), array('field' => 'varcharfield_checkboxes')));
     $this->assertTrue($pt->edit(Dataface_Table::loadTable('Test'), array('field' => 'varcharfield_checkboxes')));
 }
开发者ID:Zunair,项目名称:xataface,代码行数:11,代码来源:PermissionsToolTest.php

示例14: Dataface_SortControl

 function Dataface_SortControl($fields, $prefix = '')
 {
     if (is_string($fields)) {
         $t =& Dataface_Table::loadTable($fields);
         $fields = array_keys($t->fields(false, true));
     } else {
         $app =& Dataface_Application::getInstance();
         $query =& $app->getQuery();
         $t =& Dataface_Table::loadTable($query['-table']);
     }
     $this->table =& $t;
     $this->fields = array();
     if (isset($t->_atts['__global__'])) {
         $globalProps = $t->_atts['__global__'];
     } else {
         $globalProps = array();
     }
     foreach ($fields as $field) {
         $fieldDef =& $t->getField($field);
         if (isset($globalProps['sortable']) and !$globalProps['sortable'] and !@$fieldDef['sortable']) {
             continue;
         } else {
             if (isset($fieldDef['sortable']) and !@$fieldDef['sortable']) {
                 continue;
             }
         }
         $this->fields[] = $field;
     }
     $this->prefix = $prefix;
     //$this->fields = $fields;
     $app =& Dataface_Application::getInstance();
     $query =& $app->getQuery();
     if (!isset($query['-' . $prefix . 'sort'])) {
         $sort = '';
     } else {
         $sort = $query['-' . $prefix . 'sort'];
     }
     $sort = array_map('trim', explode(',', $sort));
     $sort2 = array();
     foreach ($sort as $col) {
         if (!trim($col)) {
             continue;
         }
         $col = explode(' ', $col);
         if (count($col) <= 1) {
             $col[1] = 'asc';
         }
         $sort2[$col[0]] = $col[1];
     }
     // Now sort2 looks like array('col1'=>'asc', 'col2'=>'desc', etc...)
     $this->current_sort =& $sort2;
     $this->fields = array_diff($this->fields, array_keys($this->current_sort));
 }
开发者ID:minger11,项目名称:Pipeline,代码行数:53,代码来源:SortControl.php

示例15: Dataface_DeleteForm

 function Dataface_DeleteForm($tablename, $db, $query)
 {
     $this->_tablename = $tablename;
     $this->_table =& Dataface_Table::loadTable($tablename);
     $this->_db = $db;
     $this->_query = $query;
     $this->_isBuilt = false;
     if (!isset($this->_query['-cursor'])) {
         $this->_query['-cursor'] = 0;
     }
     parent::HTML_QuickForm('deleteForm');
 }
开发者ID:minger11,项目名称:Pipeline,代码行数:12,代码来源:DeleteForm.php


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