本文整理汇总了PHP中Canvas::register方法的典型用法代码示例。如果您正苦于以下问题:PHP Canvas::register方法的具体用法?PHP Canvas::register怎么用?PHP Canvas::register使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Canvas
的用法示例。
在下文中一共展示了Canvas::register方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CompactDB
try {
// Database connection first.
$db = new CompactDB($mt_dbhost, $mt_dbname, $mt_dbuser, $mt_dbpass);
$q = new Query($db);
$chunks = $q->select('id,content')->from('track')->where("processed=0")->run();
// Required objects and set up
$c = new Canvas(thisURL());
$c->common->addScriptRef(APP_URL . 'files/jquery.js');
$c->common->addScriptRef(APP_URL . 'files/jquery-effects.js');
switch ($c->getMode()) {
/* --------------------------------------------------------------------------------------------------------- */
case 'show':
default:
// We create the toolbar
$t = new Toolbar();
$c->register($t);
// If there are chunks to process, we display a button.
if (count($chunks) > 0) {
$t->addAction('Process ' . count($chunks) . ' tracks', "doConfirm('This action may take a long time and make the browser\\nto timeout. Are you sure you want to do this?','process')", 'go-jump');
}
// We retrieve all the tracks we have stored in a pretty table.
$mtrx = $db->qSelect("select t.id, t.name, t.pid, from_unixtime(t.offset/1000) as t_start, round(max(e.t)/1000,1) as t_duration " . "from track as t, event as e where t.id=e.track_id and t.processed=1 group by e.track_id;");
$tab = new Table($mtrx);
$tab->setProperty('highlight', true);
$tab->setProperty('numbering', true);
$tab->setProperty('id', 'id');
$tab->setColumnProperty('id', 'visible', false);
$tab->setColumnProperty('name', 'label', 'Project');
$tab->setColumnProperty('pid', 'label', 'Ppt. ID');
$tab->setColumnProperty('t_start', 'label', 'Tracking start');
$tab->setColumnProperty('t_duration', 'label', 'Duration [s]');