Exemplo n.º 1
0
 /**
  * @return obj
  */
 public function show()
 {
     if (!isset(self::$_instance)) {
         $show = __CLASS__;
         self::$_instance = new $show();
     }
     return self::$_instance;
 }
Exemplo n.º 2
0
 function inaAction()
 {
     /* get GroupName
          echo $this->getUserGroupName('enisetiati');
        *
        */
     /* get Group Name Id
          $getGroupId = $this->getUserGroupId($this->getUserGroupName('enisetiati'));
          echo $getGroupId;
        *
        */
     /*
      * Hukumonline Indonesia
      * 11 = admin
      * 41 = klinik_admin
      * 39 = marketing
      * 36 = member_admin
      * 34 = news_admin
      * 40 = holproject
      * 20 = dc_admin
      * 25 = member_gratis
      * 26 = member_individual
      * 27 = member_corporate
      */
     $title = "<h4>MIGRASI HUKUMONLINE INDONESIA</h4><hr/>";
     echo $title . '<br>';
     $groupId = 36;
     require_once CONFIG_PATH . '/master-status.php';
     $aroMap = App_Model_Show_Migration_AroGroupMapIn::show()->getObjectsByGroup($groupId);
     /*
     echo '<pre>';
     print_r($aroMap);
     echo '</pre>';
     *
     */
     foreach ($aroMap as $value) {
         //			$modelUser = new App_Model_Db_Table_User();
         //			$rowUser = $modelUser->fetchRow("username='******'name']."'");
         //			if (!$rowUser) {
         $ignoredUser = MasterStatus::ignoreUserMigration();
         if (!in_array($value['name'], $ignoredUser)) {
             //echo $id.' - '.$value['name'].'<br>';
             $rowUser = App_Model_Show_Migration_UserIn::show()->getUser($value['name']);
             //echo $id.' - '.$rowUser['fullName'].'<br>';
             /*
                             $groupName = $this->getUserGroupName($rowUser['username']);
                             $getGroupId = $this->getUserGroupId($groupName);
             * 
             */
             if ($rowUser) {
                 $rowUser['packageId'] = $groupId;
                 //list($ret, $body) = Pandamp_Lib_Remote::serverCmd('migrationUser', $rowUser);
                 $modelUser = new App_Model_Db_Table_User();
                 $dUser = $modelUser->fetchRow("username='******'username'] . "'");
                 $groupName = $this->getGroupName($groupId);
                 if (!$dUser) {
                     $data = $this->transformMigrationUser($rowUser);
                     $result = $modelUser->insert($data);
                     if ($result) {
                         $this->updateKopel();
                         $groupName = $this->getGroupName($groupId);
                         //$acl = new Kutu_Acl_Adapter_Local();
                         $acl = Pandamp_Acl::manager();
                         //$acl->addUser($_POST['username'],$groupName);
                         $acl->addUserToGroup($rowUser['username'], $groupName);
                         $message = "\n                            <div class='box box-info closeable'>\n                            User&nbsp;:&nbsp;<abbr>" . $rowUser['username'] . "</abbr> data has been successfully saved to local.\n                            </div><br>";
                     } else {
                         $message = "\n                        <div class='box box-error'>ERROR</div>    \n                        <div class='box box-error-msg'>\n                        <ol>\n                        <li>User&nbsp;:&nbsp;<abbr>" . $rowUser['username'] . "</abbr> data has failed saved to local.</li>\n                        </ol>\n                        </div><br>";
                     }
                     echo $message;
                 }
                 /*
                 echo '<pre>';
                 print_r($body);
                 echo '</pre>';
                 die;
                 *
                 */
                 /*
                 switch ($ret)
                 {
                     case 200:
                         $message = "
                             <div class='box box-info closeable'>
                             User&nbsp;:&nbsp;<abbr>".$rowUser['username']."</abbr> data has been successfully saved to local.
                             </div><br>";
                         break;
                     default:
                         $message = "
                         <div class='box box-error'>ERROR</div>    
                         <div class='box box-error-msg'>
                         <ol>
                         <li>User&nbsp;:&nbsp;<abbr>".$rowUser['username']."</abbr> data has failed saved to local.</li>
                         </ol>
                         </div><br>";
                 }
                 */
                 //                echo $message;
             }
             /*
             else 
             {
             	echo "
                     <div class='box box-error'>ERROR</div>    
                     <div class='box box-error-msg'>
                     <ol>
                     <li>User&nbsp;:&nbsp;<abbr>".$value['name']."</abbr> not active.</li>
                     </ol>
                     </div><br>";
             }
             */
         }
         //			}
     }
 }