Beispiel #1
0
    protected function task_packages()
    {
        $divSerp = 'wd-frdl-webfan-pm-packages-main' . mt_rand(1000, 9999);
        $p = new \frdl\ApplicationComposer\Package();
        //	$packages = $p->all();
        $num = 25;
        $packages = $p->select(0, $num, array('vendor' => 'ASC', 'package' => 'ASC'));
        // sort($packages);
        $this->html .= '<div id="' . $divSerp . '">';
        foreach ($packages as $num => $package) {
            $this->html .= '<div class="data-box">';
            $this->html .= '<h2 class="webfan-blue" onclick="var p = this.getAttribute(\'data-package\'); 
                 	  	     	var e = explode(\'/\', p);
							   	$(frdl.wd()).pack(\'c\', e[0], e[1]);"
					  data-package="' . $package['vendor'] . '/' . $package['package'] . '" style="text-decoration:underline;">';
            $this->html .= $package['vendor'] . '/' . $package['package'];
            $this->html .= '</h2>';
            if (isset($package['description'])) {
                $this->html .= '<p>' . $package['description'] . '</p>';
            }
            if (isset($package['url'])) {
                $this->html .= '<p><a href="' . $package['url'] . '" style="text-decoration:underline;" target="_blank">' . $package['url'] . '</a></p>';
            }
            $this->html .= '</div>';
        }
        $this->html .= '</div>';
        $this->html .= '
		  <button onclick="var App = frdl.wd().Registry.Programs[\'frdl-webfan\'];
		  frdl.wd().wdFrdlWebfanHtmlPackagesOffset =  frdl.wd().wdFrdlWebfanHtmlPackagesOffset + ' . intval($num) . ';
		    Dom.g(\'' . $divSerp . '\').innerHTML += \'<img src=\' + base64_decode(\'Ig==\') + \'http://images.webfan.de/ajax-loader_2.gif\' + base64_decode(\'Ig==\') + \' alt=\' + base64_decode(\'Ig==\') + \'lade...\' + base64_decode(\'Ig==\') + \' style=\' + base64_decode(\'Ig==\') + \'border:none;\' + base64_decode(\'Ig==\') + \' class=\' + base64_decode(\'Ig==\') + \'img-ajax-loader\' + base64_decode(\'Ig==\') + \' />\';
	        frdl.wd().Registry.Programs[\'frdl-webfan\'].cmd(
	            \'frdl pm select --start=\' + frdl.wd().wdFrdlWebfanHtmlPackagesOffset + \' --limit=' . $num . ' -b\',  function(o){
	             	  $.each(o.packages, function(_k,i){
                 	  	     i.name = i.vendor + \'/\' + i.package;
                 	  	     var d = Dom.create(\'div\'), p, p2, h, a;
                 	  	     d.setAttribute(\'class\', \'data-box\');
                 	  	     h = Dom.create(\'h2\');
                 	  	     h.setAttribute(\'class\', \'webfan-blue\');
                 	  	     h.setAttribute(\'data-package\', i.name);
                 	  	     h.style.textDecoration=\'underline\';
                 	  	     Dom.addText(i.name, h);
                 	  	     h.onclick=function(ev){
                 	  	     	var p = this.getAttribute(\'data-package\'); 
                 	  	     	var e = explode(\'/\', p);
							   	$(App).pack(\'c\', e[0], e[1], true);
							 };
                 	  	     Dom.add(h,d);
                 	  	    
                 	  	     if(\'undefined\' !== typeof i.description){ 
                 	  	       p = Dom.create(\'p\');
                 	  	       Dom.addText(i.description, p);
                 	  	       Dom.add(p,d);
                 	  	     }
                 	  	     
                  	  	     if(\'undefined\' !== typeof i.url){
                 	  	       p2 = Dom.create(\'p\');
                 	  	       a =  Dom.create(\'a\');
                 	  	       a.setAttribute(\'href\', i.url);
                 	  	       a.style.textDecoration=\'underline\';
                 	  	       Dom.addText(i.url, a);
                 	  	       a.setAttribute(\'target\', \'_blank\');
                 	  	       Dom.add(a,p2);
                 	  	       Dom.add(p2,d);							 	
							 }
                	  	     
                 	  	     
                 	  	   
                 	  	     Dom.add(d, Dom.g(\'' . $divSerp . '\'));  
                 	  	}); 		            
              	     $(\'.img-ajax-loader\').hide();    	
	        }, true);	    
		  "><span>More</span>...</button>
		';
        $this->js .= " \n\t\tfrdl.wd().wdFrdlWebfanHtmlPackagesOffset = " . $num . ";\n\n\t\t";
    }
Beispiel #2
0
 public function select($o)
 {
     $start = $this->getRequestOption('start');
     $limit = $this->getRequestOption('limit');
     if (null === $start) {
         $start = 0;
     }
     if (null === $limit) {
         $limit = 25;
     }
     $p = new \frdl\ApplicationComposer\Package(array(), \frdl\xGlobal\webfan::db()->settings(), $this->db);
     $packages = $p->select($start, $limit, array('vendor' => 'ASC', 'package' => 'ASC'));
     $this->result->packages = $packages;
     $this->result->packages = array_unique($this->result->packages);
     $this->result->out = 'OK';
 }