示例#1
0
 public function login($remember)
 {
     parent::login($remember);
     /** check the user tables exists, if not, create **/
     global $mysqli;
     $table_name_prefix = 'user_' . $this->getId();
     self::createCategoryTableIfNotExist($table_name_prefix);
     self::createAccountTableIfNotExist($table_name_prefix);
     self::createReadTableIfNotExist($table_name_prefix);
     // add default category none
     if (UserWechatCategory::findById(1) == null) {
         $category = new UserWechatCategory();
         $category->setName('未分类');
         $category->save();
     }
 }
示例#2
0
      <a id="filter-readonly" class="glyphicon glyphicon-<?php 
echo $unread ? 'check' : 'unchecked';
?>
" href="<?php 
echo uri('articles') . build_query_string(array('category' => $category, 'unread' => $unread ? 0 : 1));
?>
">只显示未读</a>
    </div>
    <div>
      <ul id="category" class="dropdown-content">
        <li><a href="<?php 
echo uri('articles') . build_query_string(array('category' => null, 'unread' => $unread));
?>
">所有</a></li>
<?php 
foreach (UserWechatCategory::findAll() as $category) {
    ?>
        <li><a href="<?php 
    echo uri('articles') . build_query_string(array('category' => $category->getId(), 'unread' => $unread));
    ?>
"><?php 
    echo $category->getName();
    ?>
</a></li>
<?php 
}
?>
      </ul>
    </div>
  </div>
</div>
 public function getCategory()
 {
     return UserWechatCategory::findById($this->getCategoryId());
 }