function num_to_letter($num, $uppercase = TRUE) { $num -= 1; $letter = chr($num % 26 + 97); if ($num >= 26) { $letter = num_to_letter(floor($num / 26), $uppercase) . $letter; } return $uppercase ? strtoupper($letter) : $letter; }
function move_list($start, $finish, $listofmoves, $numofturns, $first, $second) { $rowstartletter = num_to_letter(substr($start, 0, 1)); $rowfinishletter = num_to_letter(substr($finish, 0, 1)); $colstartnum = substr($start, 1, 1); $colfinishnum = substr($finish, 1, 1); if ($numofturns % 2 == 0) { if ($start == 0 && $finish == 0) { $turn = $numofturns / 2 + 1; $listofmoves .= "{$turn}. no move |"; } else { $turn = $numofturns / 2 + 1; if ($turn == 1) { $player1 = substr($first, 0, 11); $player2 = substr($second, 0, 11); $listofmoves = "{$player1}"; $length = strlen($player1); for ($i = $length; $i <= 10; $i++) { $listofmoves .= " "; } $listofmoves .= "| {$player2}<br />"; } $listofmoves .= "{$turn}. {$rowstartletter}{$colstartnum} x {$rowfinishletter}{$colfinishnum} |"; } } else { if ($start == 0 && $finish == 0) { $listofmoves .= " no move<br/>"; } else { // $listofmoves .= " {$rowstartletter}{$colstartnum} x {$rowfinishletter}{$colfinishnum}<br />"; } } return $listofmoves; }
copy(CO_PATH . '/templates/book/Skeleton/Resources/Templates/website/index.twig', $book_dir . '/Resources/Templates/website/index.twig'); copy(CO_PATH . '/templates/book/Skeleton/Resources/Templates/style.css', $book_dir . '/Resources/Templates/style.css'); $book_contents = ''; $q = "SELECT * FROM " . TBL_BOOKS_STRUCTURE . " WHERE book_id='{$book_id}' and bin='0' ORDER BY sort ASC"; $result = mysql_query($q, $database->connection); $i = 1; $introduction = 1; while ($row = mysql_fetch_array($result)) { if ($row['type'] == 'chapter') { $counter = $i; $headline1_counter = 0; if ($book_chapterlabels == 2) { $counter = romanNumerals($i); } if ($book_chapterlabels == 3) { $counter = num_to_letter($i); } $book_contents .= " - { element: chapter, number: {$counter}, content: chapter{$i}.md }\n"; $t = ""; if ($book_chapterlabels > 0) { $t = $counter . '. '; } $title = $row['content']; if ($title == '') { $title = $t . 'Kapitel'; } else { $title = $t . $row['content']; } $content = "<h1>{$title}</h1>\n\n"; $id = $row['id']; $q_w = "SELECT * FROM " . TBL_BOOKS_WIDGETS . " WHERE chapter_id='{$id}' and bin='0' ORDER BY sort ASC";