Example #1
0
    function widget($args, $instance)
    {
        extract($args, EXTR_SKIP);
        echo $before_widget;
        $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']);
        if (!empty($title)) {
            echo $before_title . $title . $after_title;
        }
        // WIDGET CODE GOES HERE
        //get USM DVD Catalog
        $catalog = new ClientCatalog();
        $catalog->identifier = 8;
        $catalog->taxonomy = 'catablog-terms';
        $result = $catalog->getItems();
        print_r($result);
        ?>
                <div class="new-contents light-bg">
                	<h2 class="top-albums"></h2>

                        <?php 
        if (count($top_albums) > 0) {
            foreach ($top_albums as $albums) {
                ?>
                    	<div class="new-album">
                        	<a href="<?php 
                echo $SERVER['REQUEST_URI'];
                ?>
?page_id=51&artist_id=<?php 
                echo $albums->artist_id;
                ?>
">
                                <div class="img-holder"><img src="<?php 
                echo $albums->album_image;
                ?>
" /></div>
                                <h3><?php 
                echo $albums->album_title;
                ?>
</h3>
                                <h4><?php 
                echo $albums->artist_name;
                ?>
</h4>
                            </a>
                        </div>
                        <?php 
            }
        }
        ?>
                </div>
    <?php 
        echo $after_widget;
    }
 public function actionCompleteRegistrationAjax()
 {
     if (isset($_POST['selection']) && isset($_POST['Client'])) {
         $client = new Client();
         $client->attributes = $_POST['Client'];
         $client->preference_contact = '-';
         if ($client->save()) {
             $error = false;
             $selection = preg_split('/,/', $_POST['selection']);
             foreach ($selection as $i => $s) {
                 $cc = new ClientCatalog();
                 $cc->client_id = $client->id;
                 $cc->catalog_id = $s;
                 $cc->creation_date = date("Y-m-d H:i:s");
                 $cc->isNewRecord = true;
                 if (!$cc->save()) {
                     $error = true;
                     break;
                 }
                 unset($cc);
             }
             if (!$error) {
                 /*$quot= Quotation::model()->findByPk( $quotation->primaryKey);
                            $message = new YiiMailMessage;
                            $message->view = 'cotizador';
                            $message->setBody(array("client"=>$client,"quotation"=>$quot),'text/html');
                 		$message->setSubject('Prospecto para CotizaciĆ³n');
                             	foreach($quot->concessioner->emails as $email){
                                 if($email->type=="QUOTATION"){
                                 $message->addTo($email->description);
                            }
                           	}
                 	    // $message->addTo("*****@*****.**");
                            $message->setFrom(array(Yii::app()->params['adminEmail']=>'El Equipo Nissan Ecuador'));
                            Yii::app()->mail->send($message);*/
                 echo json_encode(true);
             } else {
                 echo json_encode(false);
             }
         } else {
             echo "no save client";
             echo json_encode($client->getErrors());
         }
     } else {
         echo 'no post';
     }
 }