本文整理汇总了PHP中TPage::isMobile方法的典型用法代码示例。如果您正苦于以下问题:PHP TPage::isMobile方法的具体用法?PHP TPage::isMobile怎么用?PHP TPage::isMobile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TPage
的用法示例。
在下文中一共展示了TPage::isMobile方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Class Constructor
* @param $type Type of the message (info, error)
* @param $message Message to be shown
* @param $action Action to process
*/
public function __construct($type, $message, TAction $action = NULL)
{
$this->id = uniqid();
if (!is_null($action)) {
$this->action = '__adianti_load_page(\'' . $action->serialize() . '\');';
}
if (TPage::isMobile()) {
$img = new TElement('img');
$img->src = "lib/adianti/images/{$type}.png";
$table = new TTable();
$table->width = '250px';
$table->bgcolor = '#E5E5E5';
$table->style = "border-collapse:collapse";
$row = $table->addRow();
$row->addCell($img);
$row->addCell($message);
$table->show();
} else {
TPage::include_css('lib/adianti/include/tmessage/tmessage.css');
// creates a pannel to show the dialog
$painel = new TElement('div');
$painel->{'class'} = 'tmessage';
$painel->id = 'tmessage_' . $this->id;
// creates a table for layout
$table = new TTable();
// creates a row for the icon and the message
$row = $table->addRow();
$row->addCell(new TImage("lib/adianti/images/{$type}.png"));
$scroll = new TScroll();
$scroll->setSize(350, 70);
$scroll->add($message);
$scroll->setTransparency(true);
$cell = $row->addCell($scroll);
// add the table to the pannel
$painel->add($table);
// show the pannel
$painel->show();
$script = new TElement('script');
$script->{'type'} = 'text/javascript';
$script->add(' $(function() {
$( "#' . $painel->id . '" ).dialog({
height: 180,
width: 440,
stack: false,
zIndex: 3000,
modal: true,
buttons: {
OK: function() {
$( this ).dialog( "close" ); ' . $this->action . '
}
}
}).css("visibility", "visible");
$( "#' . $painel->id . ' a" ).click(function () {
window.open($(this).attr(\'href\'));
});
});');
$script->show();
}
}
示例2: __construct
/**
* Class Constructor
* @param $message A string containint the question
* @param $action_yes Action taken for YES response
* @param $action_no Action taken for NO response
*/
public function __construct($message, TAction $action_yes = NULL, TAction $action_no = NULL)
{
$this->id = uniqid();
if (TPage::isMobile()) {
$img = new TElement('img');
$img->src = "lib/adianti/images/question.png";
$yes = new TElement('a');
$yes->href = $action_yes->serialize();
$yes->generator = 'adianti';
$yes->add(TAdiantiCoreTranslator::translate('Yes'));
$no = new TElement('a');
$no->href = $action_no->serialize();
$no->generator = 'adianti';
$no->add(TAdiantiCoreTranslator::translate('No'));
$table = new TTable();
$table->width = '250px';
$table->bgcolor = '#E5E5E5';
$table->style = "border-collapse:collapse";
$row = $table->addRow();
$row->addCell($img);
$table2 = new TTable();
$row->addCell($table2);
$row = $table2->addRow();
$c = $row->addCell($message);
$c->colspan = 2;
$row = $table2->addRow();
$row->addCell($yes);
$row->addCell($no);
$table->show();
} else {
TPage::include_css('lib/adianti/include/tmessage/tmessage.css');
// creates a layer to show the dialog
$painel = new TElement('div');
$painel->{'class'} = "tmessage";
$painel->id = 'tquestion_' . $this->id;
$url_yes = '';
$url_no = '';
if ($action_yes) {
// convert the actions into URL's
$url_yes = TAdiantiCoreTranslator::translate('Yes') . ': function () { $( this ).dialog( "close" ); __adianti_load_page(\'' . $action_yes->serialize() . '\');},';
}
if ($action_no) {
$url_no = TAdiantiCoreTranslator::translate('No') . ': function () { $( this ).dialog( "close" ); __adianti_load_page(\'' . $action_no->serialize() . '\');},';
} else {
$url_no = TAdiantiCoreTranslator::translate('No') . ': function () { $( this ).dialog( "close" );},';
}
// creates a table for layout
$table = new TTable();
// creates a row for the icon and the message
$row = $table->addRow();
$row->addCell(new TImage("lib/adianti/images/question.png"));
$scroll = new TScroll();
$scroll->setSize(400, 200);
$scroll->add($message);
$cell = $row->addCell($scroll);
// add the table to the pannel
$painel->add($table);
// show the pannel
$painel->show();
$script = new TElement('script');
$script->add(' $(function() {
$( "#' . $painel->id . '" ).dialog({
height: 340,
width: 500,
modal: true,
stack: false,
zIndex: 3000,
buttons: {
' . $url_yes . $url_no . TAdiantiCoreTranslator::translate('Cancel') . ': function() {
$( this ).dialog( "close" );
}
}
}).css("visibility", "visible");
});');
$script->show();
}
}