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


PHP table::factory方法代码示例

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


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

示例1:

}
if (in_array($action, ['save-add', 'save-edit']) && dyn::get('user')->hasPerm('media[category][edit]')) {
    $sql = sql::factory();
    $sql->setTable('media_cat');
    $sql->setWhere('id=' . $id);
    $sql->getPosts(['name' => 'string', 'sort' => 'int', 'pid' => 'int']);
    if ($action == 'save-edit') {
        $sql->update();
    } else {
        $sql->save();
    }
    $sort = type::post('sort', 'int');
    $parent_id = type::post('pid', 'int');
    sql::sortTable('media_cat', $sort, '`pid` = ' . $parent_id . ' AND id != ' . $id);
}
$table = table::factory(['class' => ['js-sort']]);
$colFirstWidth = $action == 'edit' || $action == 'add' ? 50 : 25;
$table->addCollsLayout($colFirstWidth . ',*, 110');
$table->addRow()->addCell()->addCell(lang::get('category'))->addCell(lang::get('action'));
$table->addSection('tbody');
$table->setSql('SELECT * FROM ' . sql::table('media_cat') . ' WHERE pid = ' . $pid . ' ORDER BY sort ASC');
if (in_array($action, ['edit', 'add']) && dyn::get('user')->hasPerm('media[category][edit]')) {
    echo '<form method="post" action="index.php">';
    $inputHidden = formInput::factory('action', 'save-' . $action);
    $inputHidden->addAttribute('type', 'hidden');
    echo $inputHidden->get();
    $inputHidden = formInput::factory('page', 'media');
    $inputHidden->addAttribute('type', 'hidden');
    echo $inputHidden->get();
    $inputHidden = formInput::factory('subpage', 'category');
    $inputHidden->addAttribute('type', 'hidden');
开发者ID:pasterntt,项目名称:dynao-CMS,代码行数:31,代码来源:media.category.php

示例2: stripPath

<?php

$error = false;
$table = table::factory();
$table->addRow()->addCell(lang::get('type'))->addCell(lang::get('value'))->addCell(lang::get('status'));
$table->addSection('tbody');
$table->addRow()->addCell(lang::get('php_version'))->addCell('>5.4');
if (version_compare(phpversion(), '5.4', '<')) {
    $table->addCell('<span class="label label-danger">' . lang::get('php_version_54') . '</span>');
} else {
    $table->addCell('<span class="label label-success">' . lang::get('ok') . '</span>');
}
$writeable = [dir::cache(), dir::backend('addons' . DIRECTORY_SEPARATOR), dir::backend('lib' . DIRECTORY_SEPARATOR . 'config.json')];
function stripPath($file)
{
    return str_replace(dir::base(), '', $file);
}
foreach ($writeable as $file) {
    $table->addRow()->addCell(stripPath($file))->addCell('0755');
    if (is_file($file)) {
        if (is_writeable($file)) {
            $table->addCell('<span class="label label-success">' . lang::get('ok') . '</span>');
        } else {
            $table->addCell('<span class="label label-danger">' . lang::get('chmod_755') . '</span>');
            $error = true;
        }
    } elseif (is_dir($file)) {
        if (is_writeable($file)) {
            $table->addCell('<span class="label label-success">' . lang::get('ok') . '</span>');
        } else {
            $table->addCell('<span class="label label-danger">' . lang::get('chmod_755') . '</span>');
开发者ID:pasternt,项目名称:dynaoCMS,代码行数:31,代码来源:general.php

示例3: getModules

 public static function getModules()
 {
     $cacheFile = cache::getFileName(0, 'dynaoModules');
     // jeden halben Tag
     if (cache::exist($cacheFile, 43200)) {
         $content = json_decode(cache::read($cacheFile), true);
     } else {
         $content = apiserver::getModulesFile();
         cache::write($content, $cacheFile);
     }
     $table = table::factory(['class' => ['table', 'table-spriped', 'table-hover']]);
     $table->addCollsLayout('60, 140, *, 110');
     $table->addRow()->addCell(lang::get('vote'))->addCell(lang::get('name'))->addCell(lang::get('description'))->addCell();
     $table->addSection('tbody');
     if (is_null($content) || !$content) {
         $table->addRow()->addCell(lang::get('no_entries'), ['colspan' => 4]);
     } else {
         foreach ($content as $addon) {
             $perc = round($addon['rate_sum'] / $addon['rate_ppl'] * 10);
             if ($perc < 33) {
                 $class = 'danger';
             } elseif ($perc < 66) {
                 $class = 'warning';
             } else {
                 $class = 'success';
             }
             $table->addRow()->addCell('<span class="label label-' . $class . '">' . $perc . '%</span>')->addCell($addon['title'])->addCell($addon['description'])->addCell('<a href="' . $addon['link'] . '" target="_blank" class="btn btn-sm btn-default">' . lang::get('import') . '</a>');
         }
     }
     return $table->show();
 }
开发者ID:pasterntt,项目名称:dynaoCMS,代码行数:31,代码来源:dyn.php

示例4: template

$table->addRow()->addCell(lang::get('php_version'))->addCell(phpversion());
$table->addRow()->addCell(lang::get('mysql_version'))->addCell($sql->get('VERSION()'));
echo $table->show();
?>
        </div>
    </div>
    
    <div class="col-lg-4">
        <div class="panel panel-default">
            <div class="panel-heading">
            	<h3 class="panel-title"><?php 
echo lang::get('template');
?>
</h3>
            </div>
			<?php 
$template = new template(dyn::get('template'));
$table = table::factory(['class' => ['table', 'table-spriped', 'table-hover']]);
$table->addSection('tbody');
$table->addRow()->addCell(lang::get('name'))->addCell($template->get('name'));
$table->addRow()->addCell(lang::get('author'))->addCell($template->get('author'));
$table->addRow()->addCell(lang::get('version'))->addCell($template->get('version'));
$table->addRow()->addCell('<a href="' . $template->get('supportlink') . '" class="btn btn-sm btn-default btn-block" target="_blank">' . lang::get('support_visit') . '</a>', ['colspan' => 2]);
echo $table->show();
?>
        </div>
    </div>
        
    <div class="clearfix"></div>

</div>
开发者ID:pasterntt,项目名称:dynao-CMS,代码行数:31,代码来源:settings.main.php

示例5: BackendShow

    protected static function BackendShow($name, $pagename)
    {
        $table = table::factory(['class' => ['js-sort']]);
        $table->setSql('SELECT * FROM ' . sql::table('metainfos') . ' WHERE `type` = "' . $name . '"');
        $table->addRow()->addCell()->addCell('Name')->addCell('Aktion');
        $table->addCollsLayout('25,*,110');
        $table->addSection('tbody');
        if ($table->numSql()) {
            while ($table->isNext()) {
                $edit = '';
                $delete = '';
                if (dyn::get('user')->hasPerm('metainfos[edit]')) {
                    $edit = '<a href="' . url::backend('meta', ['subpage' => $pagename, 'action' => 'edit', 'id' => $table->get('id')]) . '" class="btn btn-sm  btn-default fa fa-pencil-square-o"></a>';
                }
                if (dyn::get('user')->hasPerm('metainfos[delete]')) {
                    $delete = '<a href="' . url::backend('meta', ['subpage' => $pagename, 'action' => 'delete', 'id' => $table->get('id')]) . '" class="btn btn-sm btn-danger delete fa fa-trash-o"></a>';
                }
                $table->addRow(['data-id' => $table->get('id')])->addCell('<i class="fa fa-sort"></i>')->addCell($table->get('name'))->addCell('<span class="btn-group">' . $edit . $delete . '</span>');
                $table->next();
            }
        } else {
            $table->addRow()->addCell(lang::get('no_entries'), ['colspan' => 3]);
        }
        ?>
<div class="row">
	<div class="col-lg-12">
		<div class="panel panel-default">
			<div class="panel-heading">
				<h3 class="panel-title pull-left"><?php 
        echo backend::getSubpageName();
        ?>
</h3>
                <?php 
        if (dyn::get('user')->hasPerm('metainfos[edit]')) {
            ?>
				<div class="btn-group pull-right">
					<a href="<?php 
            echo url::backend('meta', ['subpage' => $pagename, 'action' => 'add']);
            ?>
" class="btn btn-sm btn-default"><?php 
            echo lang::get('add');
            ?>
</a>
				</div>
                <?php 
        }
        ?>
				<div class="clearfix"></div>
			</div>
			<?php 
        echo $table->show();
        ?>
		</div>
	</div>
</div>
		<?php 
    }
开发者ID:pasterntt,项目名称:dynao-CMS,代码行数:57,代码来源:metainfosPage.php

示例6: while

 $sql = sql::factory();
 $cats = $sql->num('SELECT id FROM ' . sql::table('media_cat') . ' LIMIT 1');
 if (!$cats) {
     echo message::warning('Please add at first a Category');
     return;
 }
 if (!$catId) {
     $catId = type::session('media_cat', 'int', $catId);
 }
 if (!$catId) {
     $sql = sql::factory();
     $sql->query('SELECT id FROM ' . sql::table('media_cat') . ' ORDER BY id LIMIT 1')->result();
     $catId = $sql->get('id');
 }
 type::addSession('media_cat', $catId);
 $table = table::factory(['class' => ['media-table']]);
 $table->setSql('SELECT * FROM ' . sql::table('media') . ' WHERE `category` = ' . $catId);
 $table->addRow()->addCell()->addCell()->addCell(lang::get('title'))->addCell(lang::get('file_type'))->addCell(lang::get('action'));
 $table->addCollsLayout('20, 50,*,100,110');
 $table->addSection('tbody');
 if ($table->numSql()) {
     while ($table->isNext()) {
         $media = new media($table->getSql());
         if (dyn::get('user')->hasPerm('media[edit]')) {
             $edit = '<a href="' . url::backend('media', ['subpage' => 'files', 'action' => 'edit', 'id' => $table->get('id')]) . '" class="btn btn-sm btn-default fa fa-pencil-square-o"></a>';
         }
         if (dyn::get('user')->hasPerm('media[delete]')) {
             $delete = '<a href="' . url::backend('media', ['subpage' => 'files', 'action' => 'delete', 'id' => $table->get('id')]) . '" class="btn btn-sm btn-danger fa fa-trash-o delete"></a>';
         }
         $checkbox = formCheckbox::factory('file[]', 0);
         $checkbox->add($media->get('id'), '');
开发者ID:pasterntt,项目名称:dynao-CMS,代码行数:31,代码来源:media.files.php

示例7: getAddons

 public static function getAddons()
 {
     $cacheFile = cache::getFileName(0, 'dynaoAddons');
     // jeden halben Tag
     if (cache::exist($cacheFile, 43200)) {
         $content = json_decode(cache::read($cacheFile), true);
     } else {
         $server = 'http://api.dynao.de/addons.json';
         $ch = curl_init($server);
         curl_setopt($ch, CURLOPT_PORT, 80);
         curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla (Statuscheck-Script)');
         curl_setopt($ch, CURLOPT_TIMEOUT, 0);
         curl_setopt($ch, CURLOPT_DNS_CACHE_TIMEOUT, 300);
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
         $curl = curl_exec($ch);
         curl_close($ch);
         $content = json_decode($curl, true);
         cache::write($content, $cacheFile);
     }
     $table = table::factory(['class' => ['table', 'table-spriped', 'table-hover']]);
     $table->addCollsLayout('60, 140, *, 110');
     $table->addRow()->addCell(lang::get('vote'))->addCell(lang::get('name'))->addCell(lang::get('description'))->addCell();
     $table->addSection('tbody');
     if (is_null($content)) {
         $table->addRow()->addCell(lang::get('no_entries'), ['colspan' => 4]);
     } else {
         foreach ($content as $addon) {
             $perc = round($addon['rate_sum'] / $addon['rate_ppl'] * 10);
             if ($perc < 33) {
                 $class = 'danger';
             } elseif ($perc < 66) {
                 $class = 'warning';
             } else {
                 $class = 'success';
             }
             $table->addRow()->addCell('<span class="label label-' . $class . '">' . $perc . '%</span>')->addCell($addon['title'])->addCell($addon['description'])->addCell('<a href="' . $addon['link'] . '" target="_blank" class="btn btn-sm btn-default">' . lang::get('download') . '</a>');
         }
     }
     return $table->show();
 }
开发者ID:pasternt,项目名称:dynaoCMS,代码行数:40,代码来源:dyn.php


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