Exemplo n.º 1
0
 public function testOffsetUnset()
 {
     $list = new CList(array(1, 2, 3));
     $list->offsetUnset(1);
     $this->assertEquals(array(1, 3), $list->toArray());
 }
Exemplo n.º 2
0
 /**
  * @param array attributes key for get.
  * @return array
  */
 public function getEavAttributes($attributes = array())
 {
     // Get all attributes if not specified.
     if (empty($attributes)) {
         $attributes = $this->getSafeAttributesArray();
     }
     // Values array.
     $values = array();
     // Queue for load.
     $loadQueue = new CList();
     foreach ($attributes as $attribute) {
         // Check is safe.
         if ($this->hasSafeAttribute($attribute)) {
             $values[$attribute] = $this->attributes->itemAt($attribute);
             // If attribute not set and not load, prepare array for loaded.
             if (!$this->preload && $values[$attribute] === NULL) {
                 $loadQueue->add($attribute);
             }
         }
     }
     // If array for loaded not empty, load attributes.
     if (!$this->preload && $loadQueue->count() > 0) {
         $this->loadEavAttributes($loadQueue->toArray());
         foreach ($loadQueue as $attribute) {
             $values[$attribute] = $this->attributes->itemAt($attribute);
         }
     }
     // Delete load queue.
     unset($loadQueue);
     // Return values.
     return $values;
 }
 /**
  * Lists all models.
  */
 public function actionIndex()
 {
     $user = User::model()->findByAttributes(array("username" => Yii::app()->user->getId()));
     $meetingsId = new CList();
     $invitations = VCInvitation::model()->findAllByAttributes(array("invitee_id" => $user->id));
     foreach ($invitations as $inv) {
         $meetingsId->add($inv->videoconference_id);
     }
     $meetings = VideoConference::model()->findAllByAttributes(array("moderator_id" => $user->id));
     foreach ($meetings as $meeting) {
         $meetingsId->add($meeting->id);
     }
     //$dataProvider = new CActiveDataProvider('VideoConference');
     $this->render('index', array('meetingsId' => $meetingsId->toArray()));
 }