Beispiel #1
0
 public function actionGetboard()
 {
     $session = Yii::app()->session;
     $boards = array();
     if (isset($session['token'])) {
         $token = $session['token'];
         $client = new Trello\Client();
         $client->authenticate('658f0e49767a334eb04b65d1c43167b4', $token, Client::AUTH_URL_CLIENT_ID);
         $boardID = "";
         $listID = "";
         $boards = $client->api('member')->boards()->all("me", array());
         foreach ($boards as $board) {
             // Insert board to DB
             $boardID = $board['id'];
             $board_name = $board['name'];
             $user_id = "658f0e49767a334eb04b65d1c43167b4";
             Boards::insertBoard($boardID, $board_name, $user_id);
             $lists = $client->api('boards')->lists()->all("{$boardID}", array());
             foreach ($lists as $list) {
                 // Insert list to DB
                 $listID = $list['id'];
                 $name = $list['name'];
                 Lists::insertList($listID, $name, $boardID);
                 $cards = $client->api('lists')->cards()->all("{$listID}", array());
                 foreach ($cards as $card) {
                     // Insert card to DB
                     $card_id = $card['id'];
                     $card_name = $card['name'];
                     $card_des = $card['desc'];
                     $card_due = $card['due'];
                     Cards::insertCard($card_id, $card_name, $card_des, $card_due, $listID);
                 }
             }
         }
         // // Get list boards
         // $boards = $client->api('member')->boards()->all("me", array());
     }
     return $this->render("getboard", array('boards' => $boards));
 }