本文整理汇总了PHP中Data类的典型用法代码示例。如果您正苦于以下问题:PHP Data类的具体用法?PHP Data怎么用?PHP Data使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Data类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getForeignRecord
/**
* @param string $source Name of foreign source (ex., "people")
* @param array $constraints Array of key/value constraints (ex., "id" => 1)
* @return array
*/
protected function getForeignRecord($source, array $constraints = [])
{
// @todo Cache foreign records instead of reading off disk every time
$sourceForeign = $this->source->parent()->child("{$source}.json");
$dataForeign = new Data($sourceForeign);
return $dataForeign->getRecords($constraints);
}
示例2: indexAction
public function indexAction()
{
// Get, check and setup the parameters
if (!($widget_id = $this->getRequest()->getParam("id"))) {
throw new Stuffpress_Exception("No widget id provided to the widget controller");
}
// Verify if the requested widget exist and get its data
$widgets = new Widgets();
if (!($widget = $widgets->getWidget($widget_id))) {
throw new Stuffpress_Exception("Invalid widget id");
}
// Get the last comments
$comments = new Comments(array(Stuffpress_Db_Table::USER => $widget['user_id']));
$mycomments = $comments->getLastComments();
$data = new Data();
// Prepare the comments for output
foreach ($mycomments as &$comment) {
$time = strtotime($comment['timestamp']);
$item = $data->getItem($comment['source_id'], $comment['item_id']);
$comment['item'] = $item;
$comment['when'] = Stuffpress_Date::ago($time, "j M y");
$comment['comment'] = str_replace("\n", " ", $comment['comment']);
if (strlen($comment['comment']) > 50) {
$comment['comment'] = mb_substr($comment['comment'], 0, 47) . "...";
}
}
// Get the widget properties
$properties = new WidgetsProperties(array(Properties::KEY => $widget_id));
$title = $properties->getProperty('title');
$this->view->title = $title ? $title : "Latest comments";
// Prepare the view for rendering
$this->view->comments = $mycomments;
}
示例3: setWhere
/**
*
* @param \petry\database\Data $data
* @param type $operator
* @return \petry\database\Update
*/
protected function setWhere(Data $data, $operator = 'AND')
{
$op = is_null($this->where) ? ' WHERE' : ' ' . $operator . ' ';
$this->where .= $op . ' ' . $data->getVariable() . $data->getOperator() . ' :' . $data->getVariable();
$this->whereBindValue[] = $data;
return $this;
}
示例4: build
/**
* @param $parts
* @param $value
* @return Data
*/
public static function build($parts, $value)
{
$data = new Data();
$data->setPath($parts);
$data->setValue($value);
return $data;
}
示例5: watch
function watch()
{
$returnStr = $this->showHeader(Language::messageSMSTitle());
$returnStr .= $this->displayComboBox();
$returnStr .= "<form method='post'>";
$params = getSessionParams();
//$params['reportpage'] = 'reportRes';
$returnStr .= setSessionParamsPost($params);
$returnStr .= '<div id="wrap">';
$returnStr .= '<div class="container"><p>';
$returnStr .= '<div class="panel panel-default">
<div class="panel-heading">';
$returnStr .= '<h4>' . Language::linkWatch() . '</h4>';
$returnStr .= ' </div>
<div class="panel-body">';
require_once 'data.php';
require_once 'display.php';
$data = new Data();
$values = $data->getRespondentData(getFromSessionParams('watchsuid'), getFromSessionParams('watchprimkey'));
$returnStr .= '</div>
<div role="panel" class="panel">';
if (sizeof($values) == 0) {
$returnStr .= "<br/>" . '<div class="alert alert-warning">' . Language::labelWatchNoData() . '</div>';
} else {
$returnStr .= $this->displayDataTablesScripts(array("colvis", "rowreorder"));
$returnStr .= "<script type='text/javascript'>\n \$(document).ready(function(){\n \$('#issuetable').dataTable(\n {\n \"iDisplayLength\": 5,\n dom: 'C<\"clear\">lfrtip',\n searching: false,\n paging: true\n } \n );\n \n });</script>\n\n ";
//
$returnStr .= "<br/><table id='issuetable' class='table table-bordered table-striped'><thead>";
$returnStr .= "<th>" . Language::labelWatchVariable() . "</th><th>" . Language::labelWatchValue() . "</th><th>" . Language::labelWatchClean() . "</th><th>" . Language::labelWatchMode() . "</th><th>" . Language::labelWatchLanguage() . "</th><th>" . Language::labelWatchTime() . "</th></tr>";
$returnStr .= "</thead><tbody>";
$modes = Common::surveyModes();
$languages = Language::getLanguagesArray();
$sesid = session_id();
require_once 'object.php';
require_once 'component.php';
require_once 'setting.php';
require_once 'type.php';
require_once 'variabledescriptive.php';
$survey = new Survey(getFromSessionParams('watchsuid'));
foreach ($values as $is) {
$returnStr .= "<tr>";
$returnStr .= "<td>" . $is["variablename"] . "</td>";
$returnStr .= "<td>" . $this->getDisplayValue($survey->getVariableDescriptiveByName($is["variablename"]), $is["answer_dec"]) . "</td>";
$returnStr .= "<td>" . $this->displayDirty([$is["dirty"]]) . "</td>";
$returnStr .= "<td>" . $modes[$is["mode"]] . "</td>";
$returnStr .= "<td>" . $languages[str_replace("_", "", getSurveyLanguagePostFix($is["language"]))]['name'] . "</td>";
$returnStr .= "<td>" . $is["ts"] . "</td>";
$returnStr .= "</tr>";
}
$returnStr .= "</tbody></table>";
}
$returnStr .= '</div>
</div>
</div>';
$returnStr .= ' </div></div>';
$returnStr .= '</p></div> </div>';
//container and wrap
$returnStr .= $this->showFooter(false);
echo $returnStr;
}
示例6: formatData
public function formatData()
{
// The file "pb_proto_person.php" was created with the following code:
// require_once(dirname(__FILE__) . '/../libs/protocolbuf/parser/pb_parser.php');
// $filename = dirname(__FILE__) . '/person.proto';
// $parser = new PBParser();
// $parser->parse($filename);
$array = new Data();
$data = $this->getData();
while ($entry = $data->next()) {
$person = $array->add_person();
$person->set_entryId(intval($entry['id']));
$person->set_firstName($entry['first_name']);
$person->set_lastName($entry['last_name']);
$person->set_phone($entry['phone']);
$person->set_email($entry['email']);
$person->set_address($entry['address']);
$person->set_city($entry['city']);
$person->set_zip($entry['zip']);
$person->set_state($entry['state']);
$person->set_country($entry['country']);
$person->set_description($entry['description']);
$person->set_password($entry['password']);
$person->set_createdOn($entry['created_on']);
$person->set_modifiedOn($entry['modified_on']);
}
return $array->SerializeToString();
}
示例7: table
public static function table($name)
{
$file = new Data();
$file->name = $name;
$file->setType('data');
return $file;
}
示例8: testPerform
/**
* @return void
*/
public function testPerform()
{
$data = new Data($this->progress, $this->source, $this->destination, $this->recordFactory, $this->helper);
$this->assertTrue($data->perform());
foreach ($this->destinationDocuments as $documentName => $recordsCount) {
$this->assertEquals($recordsCount, count($this->destination->getRecords($documentName, 0)));
}
}
示例9: waw2Data
public function waw2Data()
{
$Data = new Data();
$w2 = $this->dateFormat($Data->getWaw2());
$day = substr($w2, 0, 2);
$day2 = (int) $day + 1;
$w2 = $day . "-" . $day2 . substr($w2, 2);
return $w2;
}
示例10: linkEdit
public static function linkEdit(Data $data, $textLink)
{
$baseUrl = LinkController::getBaseURL();
$idData = $data->getId();
$link = "<a href='{$baseUrl}/admin/datacenter/dado/edit/{$idData}'>";
$link .= $textLink;
$link .= "</a>";
echo $link;
}
示例11: checkNumData
public function checkNumData($agency_code, $data_id)
{
$data_obj = new Data();
$arr_data[] = $data_id;
$data_info = $data_obj->getDataInfo($arr_data);
$table_name = $data_info[0]->table_name;
list($table, $field, $datefield) = explode("-", $table_name);
$rs = DB::connection('nhc_data')->table($table)->where('agency_id', '=', $agency_code)->count();
return $rs;
}
示例12: rearr
function rearr($array)
{
arrayRecursive($array, 'urlencode', true);
$data = new Data();
$data->setData($array);
$data->setMd5(md5(urldecode(json_encode($array))));
$_SESSION['token'] = md5(time());
$data->setToken($_SESSION['token']);
echo urldecode(json_encode($data));
}
示例13: dashboard
public function dashboard()
{
if (Auth::is_valid()) {
$data = new Data();
$carpeta = new Carpeta();
$this->data = $data->find();
$this->carpetas = $carpeta->get_nombre_carpetas_by_user_id(Auth::get("id"));
$this->obj_carpeta_data = new CarpetaData();
}
}
示例14: table1Action
public function table1Action()
{
$this->view->disable();
if ($this->request->isAjax() == true) {
$response = new \Phalcon\Http\Response();
$response->setContentType('application/json', 'UTF-8');
$db_data = new Data();
$response->setContent($db_data->get_table_data_json($this->request->getPost(), $this->config->table_1->toArray()));
return $response;
}
}
示例15: turnDataToJson
/**
* @test
*/
public function turnDataToJson()
{
$subgroup = new Subgroup("subgrupo");
$font = new Font("fonte");
$type = new CoffeType("type");
$variety = new Variety("variety", 1);
$origin = new Country("origin");
$destiny = new Country("destiny");
$data = new Data(1990, $subgroup, $font, $type, $variety, $origin, $destiny);
$this->assertEquals($this->jsonExpected(), $data->toJson());
}