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


PHP Dataface_Table类代码示例

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


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

示例1: init

 function init(Dataface_Table $table)
 {
     if (!@Dataface_Application::getInstance()->_conf['enable_static']) {
         $efl =& $table->getField('enable_live_translation');
         $efl['Default'] = 1;
         $efl['widget']['type'] = 'hidden';
     }
 }
开发者ID:gtoffoli,项目名称:swete,代码行数:8,代码来源:websites.php

示例2: foreach

 function &buildWidget(&$record, &$field, &$form, $formFieldName, $new = false)
 {
     /*
      *
      * This field uses a table widget.
      *
      */
     $table =& $record->_table;
     $formTool =& Dataface_FormTool::getInstance();
     $factory =& Dataface_FormTool::factory();
     $widget =& $field['widget'];
     $el =& $factory->addElement('table', $formFieldName, $widget['label']);
     if (isset($widget['fields'])) {
         $widget_fields =& $widget['fields'];
         foreach ($widget_fields as $widget_field) {
             $widget_field =& Dataface_Table::getTableField($widget_field, $this->db);
             if (PEAR::isError($widget_field)) {
                 return $widget_field;
             }
             $widget_widget = $formTool->buildWidget($record, $widget_field, $factory, $widget_field['name']);
             $el->addField($widget_widget);
         }
     } else {
         if (isset($field['fields'])) {
             foreach (array_keys($field['fields']) as $field_key) {
                 $widget_widget = $formTool->buildWidget($record, $field['fields'][$field_key], $factory, $field['fields'][$field_key]['name']);
                 $el->addField($widget_widget);
                 unset($widget_widget);
             }
         }
     }
     return $el;
 }
开发者ID:promoso,项目名称:HVAC,代码行数:33,代码来源:table.php

示例3: handle

 function handle(&$params)
 {
     $app =& Dataface_Application::getInstance();
     $record =& $app->getRecord();
     $context = array();
     if (!$record) {
         return PEAR::raiseError("No record is currently selected", DATAFACE_E_ERROR);
     }
     $history_tablename = $record->_table->tablename . '__history';
     if (!Dataface_Table::tableExists($history_tablename)) {
         $context['error'] = PEAR::raiseError("This record has no history yet recorded.", DATAFACE_E_NOTICE);
     } else {
         import('Dataface/HistoryTool.php');
         $history_tool = new Dataface_HistoryTool();
         $history_log = $history_tool->getHistoryLog($record);
         $context['log'] =& $history_log;
         // let's make a query string for the current record
         //current_record_qstr
         $keys = array_keys($record->_table->keys());
         $qstr = array();
         foreach ($keys as $key) {
             $qstr[] = urlencode('--__keys__[' . $key . ']') . '=' . urlencode($record->strval($key));
         }
         $context['current_record_qstr'] = implode('&', $qstr);
     }
     df_display($context, 'Dataface_RecordHistory.html');
 }
开发者ID:promoso,项目名称:HVAC,代码行数:27,代码来源:history.php

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

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

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

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

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

示例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_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

示例11: __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

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

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

示例14: handle

    function handle(&$params)
    {
        $app =& Dataface_Application::getInstance();
        $tt = new Dataface_TranslationTool();
        if (!Dataface_Table::tableExists('dataface__translation_submissions', false)) {
            $tt->createTranslationSubmissionsTable();
            header('Location: ' . $app->url(''));
            exit;
        }
        if (!@$_POST['--submit']) {
            df_display(array('query' => $app->getQuery(), 'success' => @$_REQUEST['--success']), 'Dataface_submit_translation.html');
            exit;
        } else {
            if (@$_POST['subject']) {
                // This is a dummy field - possible hacking attempt
                header('Location: ' . $app->url('-action=list'));
                exit;
            }
            if (@$_POST['--recordid']) {
                $record = df_get_record_by_id($_POST['--recordid']);
                $values = array('record_id' => @$_POST['--recordid'], 'language' => @$_POST['--language'], 'url' => @$_POST['--url'], 'original_text' => @$_POST['--original_text'], 'translated_text' => @$_POST['--translated_text'], 'translated_by' => @$_POST['--translated_by']);
                $trec = new Dataface_Record('dataface__translation_submissions', array());
                $trec->setValues($values);
                $trec->save();
                $email = <<<END
 The following translation was submitted to the web site {$app->url('')}:
 
 Translation for record {$record->getTitle()} which can be viewed at {$record->getURL('-action=view')}.
 This translation was submitted by {$_POST['--translated_by']} after viewing the content at {$_POST['--url']}.
 
 The original text that was being translated is as follows:
 
 {$_POST['--original_text']}
 
 The translation proposed by this person is as follows:
 
 {$_POST['--translated_text']}
 
 For more details about this translation, please visit {$trec->getURL('-action=view')}.
END;
                if (@$app->_conf['admin_email']) {
                    mail($app->_conf['admin_email'], 'New translation submitted', $email);
                }
                if (@$_POST['--redirect'] || @$_POST['--url']) {
                    $url = @$_POST['--redirect'] ? $_POST['--redirect'] : $_POST['--url'];
                    header('Location: ' . $url . '&--msg=' . urlencode('Thank you for your submission.'));
                    exit;
                } else {
                    header('Location: ' . $app->url('') . '&--success=1&--msg=' . urlencode('Thank you for your submission.'));
                    exit;
                }
            } else {
                trigger_error("No record id was provided", E_USER_ERROR);
            }
        }
    }
开发者ID:promoso,项目名称:HVAC,代码行数:56,代码来源:submit_translation.php

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


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