本文整理汇总了PHP中CMbString::roman2dec方法的典型用法代码示例。如果您正苦于以下问题:PHP CMbString::roman2dec方法的具体用法?PHP CMbString::roman2dec怎么用?PHP CMbString::roman2dec使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMbString
的用法示例。
在下文中一共展示了CMbString::roman2dec方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addChapter
/**
* Add a chapter to the Cim10 database
*
* @param array $master_entry The master entry
* @param array $chapter_entry The chapter entry
*
* @return void
*/
function addChapter($master_entry, $chapter_entry)
{
/* We remove the useless characters in the code */
$master_entry['code'] = self::cleanCode($master_entry['code']);
$code = '(' . $master_entry['code'] . ')';
list($sort) = explode('-', $master_entry['code']);
$date = CMbDT::format($master_entry['date'], '%Y-%m-%d 00:00:00');
/* Check if the chapter already exists */
$query = "SELECT `SID` FROM `master` WHERE `code` LIKE '{$code}' AND `type` = 'C';";
if (!is_null($this->ds->loadResult($query))) {
return;
}
/* Insert the chapter in the master table*/
$query = "INSERT INTO `master` (`code`, `sort`, `abbrev`, `level`, `type`, `valid`, `date`, `author`)\n VALUES ('{$code}', '{$sort}\\'', '{$code}', '1', 'C', 1, '{$date}', '" . $master_entry['origine'] . "');";
if ($this->ds->exec($query)) {
$this->added_codes++;
/* Get the SID of the chapter */
$sid = $this->ds->insertId();
/* Update the master entry for setting the id1 */
$query = "UPDATE `master` SET `id1` = {$sid} WHERE `SID` = {$sid};";
$this->ds->exec($query);
/* Insert the label */
$this->insertLabel($sid, 'S', self::cleanLabel($master_entry['label']), $date, $master_entry['origine']);
$rom = str_replace('Chapitre ', '', $chapter_entry['code']);
$dec = CMbString::roman2dec($rom);
/* Create the chapter in the chapter table */
$query = "INSERT INTO `chapter` (`chap`, `SID`, `rom`) VALUES ({$dec}, {$sid}, '{$rom}');";
$this->ds->exec($query);
}
}