Пример #1
0
 /**
  * Returns a frame number link as used in stories, for RTK index number.
  * 
  * @param  array    $matches  Reg exp matches, $matches[1] is the kanji id
  * 
  * @return string
  */
 public static function getFormattedKanjiLink($matches)
 {
     $id = $matches[1];
     $keyword = KanjisPeer::getKeyword($id);
     $link = link_to($keyword, 'study/edit?id=' . $id);
     return sprintf('%s <span class="index">(#%d)</span>', $link, $id);
 }
Пример #2
0
 /**
  * Takes a string of Japanese text and returns the kanji with links to
  * the Study page, and the title attribute contains the RTK keyword.
  * 
  * @param string $compound 
  * 
  * @return string  Html markup
  */
 public static function getKeywordizedCompound($compound)
 {
     $chars = CJK::splitU($compound);
     //DBG::out(print_r($chars, true));
     $s = '';
     coreToolkit::loadHelpers(array('Tag', 'Url'));
     foreach ($chars as $c) {
         if (false !== ($framenum = rtkBook::getIndexForKanji($c))) {
             $keyword = KanjisPeer::getKeyword($framenum);
             // FIXME - internal uri should be '@study_edit?id=' once it goes to production site..
             $url = link_to($c, 'http://kanji.koohii.com/study/kanji/' . $c, array('title' => $keyword));
             $s = $s . $url;
         } else {
             $s = $s . $c;
         }
     }
     //DBG::out($s);exit;
     return $s;
 }
Пример #3
0
 /**
  * Takes a string of Japanese text and returns the kanji with links to
  * the Study page, and the title attribute contains the RTK keyword.
  * 
  * @param string $compound 
  * 
  * @return string  Html markup
  */
 public static function getKeywordizedCompound($compound)
 {
     $chars = CJK::splitU($compound);
     //DBG::out(print_r($chars, true));
     $s = '';
     coreToolkit::loadHelpers(array('Tag', 'Url'));
     foreach ($chars as $c) {
         if (false !== ($framenum = rtkBook::getIndexForKanji($c))) {
             $keyword = KanjisPeer::getKeyword($framenum);
             $url = link_to($c, '@study_edit?id=' . $c, array('title' => $keyword));
             $s = $s . $url;
         } else {
             $s = $s . $c;
         }
     }
     //DBG::out($s);exit;
     return $s;
 }