本文整理汇总了PHP中Chart::setTheme方法的典型用法代码示例。如果您正苦于以下问题:PHP Chart::setTheme方法的具体用法?PHP Chart::setTheme怎么用?PHP Chart::setTheme使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Chart
的用法示例。
在下文中一共展示了Chart::setTheme方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: copyChart
public function copyChart($src)
{
$chart = new Chart();
// new id
$chart->setId($this->getUnusedRandomId());
// but the rest remains the same
$chart->setUser($src->getUser());
$chart->setTitle($src->getTitle() . ' (' . __('Copy') . ')');
$chart->setMetadata(json_encode($src->getMetadata()));
$chart->setTheme($src->getTheme());
$chart->setLocale($src->getLocale());
$chart->setType($src->getType());
$chart->setCreatedAt(time());
$chart->setLastModifiedAt(time());
$chart->setLastEditStep(3);
// we need to copy the data, too
$chart->writeData($src->loadData());
$chart->save();
return $chart;
}
示例2: User
$user = new User();
$user->setEmail('test');
$pwd = !empty($dw_config['testuser_pwd']) ? $dw_config['testuser_pwd'] : 'test';
$user->setPwd(hash_hmac('sha256', $pwd, DW_AUTH_SALT));
$user->setRole('editor');
$user->setCreatedAt(time());
$user->save();
$themes = DatawrapperTheme::all(true);
foreach (glob("../test/test-charts/*.json") as $test) {
$config = json_decode(file_get_contents($test), true);
$data = $config['_data'];
unset($config['_data']);
unset($config['_sig']);
if (isset($config['_id'])) {
$config['metadata']['describe']['__test_id'] = $config['_id'];
unset($config['_id']);
}
unset($config['id']);
foreach ($themes as $theme) {
$chart = new Chart();
$chart->setId(ChartQuery::create()->getUnusedRandomId());
$chart->setUser($user);
$chart->unserialize($config);
$chart->writeData($data);
$chart->setTheme($theme['id']);
$chart->setLastEditStep(5);
$chart->save();
}
}
print "To see the charts, please visit\n";
print 'http://' . $GLOBALS['dw_config']['domain'] . '/admin/charts/' . $user->getId() . "\n";