コード例 #1
0
ファイル: CobaltHelper.php プロジェクト: houzhenggang/cobalt
 public static function showShareDialog()
 {
     $app = \Cobalt\Container::fetch('app');
     $document = $app->getDocument();
     $document->addScriptDeclaration('var users=' . json_encode(UsersHelper::getAllSharedUsers()) . ';');
     $html = "<div class='modal hide fade' role='dialog' tabindex='-1' aria-hidden='true' id='share_item_dialog'>";
     $html .= '<div class="modal-header small"><button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button><h3>' . TextHelper::_('COBALT_SHARING_ITEM') . '</h3></div>';
     $html .= '<div class="modal-body">';
     $html .= '<div>' . TextHelper::_('COBALT_SHARE_DESC') . '</div>';
     $html .= '<div class="input-append">';
     $html .= '<input id="shared_user_name" class="inputbox" type="text" placeholder="' . TextHelper::_('COBALT_BEGIN_TYPING_USER') . '" />';
     $html .= '<input type="hidden" name="shared_user_id" id="shared_user_id" />';
     $html .= '<a class="btn btn-success" href="javascript:void(0);" onclick="shareItem();"><i class="glyphicon glyphicon-plus icon-white"></i>' . TextHelper::_('COBALT_ADD') . '</a>';
     $html .= '</div>';
     $html .= '<div id="shared_user_list">';
     $itemId = $app->input->get('id');
     $itemType = $app->input->get('layout');
     $users = UsersHelper::getItemSharedUsers($itemId, $itemType);
     if (count($users) > 0) {
         foreach ($users as $user) {
             $html .= '<div id="shared_user_' . $user->value . '"><i class="glyphicon glyphicon-user"></i>' . $user->label . " - <a class='btn btn-danger btn-mini' href='javascript:void(0);' onclick='unshareItem(" . $user->value . ");'>" . TextHelper::_('COBALT_REMOVE') . "</a></div>";
         }
     }
     $html .= '</div>';
     $html .= "</div>";
     $html .= '</div>';
     return $html;
 }