Pobiera dane z profilera
@return array
772714
public function get()
    {
        $elapsed = $this->elapsed();
        //iteracja po danych
        foreach ($this->_data as $key => $item) {
            if ($elapsed == 0) {
                $this->_data[$key]['percent'] = 0;
                continue;
            }
            $this->_data[$key]['percent'] = 100 * $item['elapsed'] / $elapsed;
        }
        return $this->_data;
    }
1000429
public function profileAction()
    {
      // fix new implementation of servicelocator
        try {
            $translator = $this->getServiceLocator()->get('MvcTranslator');
        } catch (\Exception $e) {
          //echo ($e->getMessage());
        }
        if (! $this->zfcUserAuthentication()->hasIdentity()) {
            return $this->redirect()->toUrl(
                $this->url()->fromRoute(
                    $this->getOptions()->getLoginRedirectRoute(),
                    array(),
                    array('force_canonical' => true)
                )
            );
        }
        $formEmail     = $this->getChangeEmailForm();
        $formEmail->get('credential')
                  ->setLabel($translator->translate('Your password', 'playgrounduser'))
                  ->setAttributes(array(
                      'type'            => 'password',
                      'class'        => 'large-input',
                      'placeholder'    => $translator->translate('Your password', 'playgrounduser')
                  ));
        $formEmail->get('newIdentity')
                  ->setLabel($translator->translate('Your new email', 'playgrounduser'))
                  ->setAttributes(array(
                      'type'            => 'email',
                      'class'        => 'large-input',
                      'placeholder'    => $translator->translate('Your new email', 'playgrounduser')
                  ));
        $formEmail->get('newIdentityVerify')
                  ->setLabel($translator->translate('Confirm the new email', 'playgrounduser'))
                  ->setAttributes(array(
                      'type'            => 'email',
                      'class'        => 'large-input',
                      'placeholder'    => $translator->translate('Confirm the new email', 'playgrounduser')
                  ));
        $formPassword  = $this->getChangePasswordForm();
        $formPassword->get('credential')
                     ->setLabel($translator->translate('Your current password', 'playgrounduser'))
                     ->setAttributes(array(
                         'class'    => 'large-input',
                         'type'        => 'password',
                         'placeholder' => $translator->translate('Your current password', 'playgrounduser')
                     ));
        $formPassword->get('newCredential')
                     ->setLabel($translator->translate('New Password', 'playgrounduser'))
                     ->setAttributes(array(
                         'class'    => 'large-input',
                         'type'        => 'password',
                         'placeholder' => $translator->translate('New Password', 'playgrounduser')
                     ));
        $formPassword->get('newCredentialVerify')
                     ->setLabel($translator->translate('Verify New Password', 'playgrounduser'))
                     ->setAttributes(array(
                         'class'    => 'large-input',
                         'type'        => 'password',
                         'placeholder' => $translator->translate('Verify New Password', 'playgrounduser')
                     ));
        ;
        $formInfo      = $this->getChangeInfoForm();
        $formPrize     = $this->getPrizeCategoryForm();
        $formBlock     = $this->getBlockAccountForm();
        if ($this->zfcUserAuthentication()->getIdentity()->getState() == 2) {
            $formBlock->get('activate')->setAttribute('value', 1);
            $formBlock->get('submit')->setAttribute('value', $translator->translate('Reactivate my account', 'playgrounduser'));
            $formBlock->get('confirm_submit')->setAttribute('value', $translator->translate('Confirm account reactivation', 'playgrounduser'));
        }

        $categoryService = $this->getServiceLocator()->get('playgroundgame_prizecategoryuser_service');
        $categoriesUser = $categoryService->getPrizeCategoryUserMapper()->findBy(array('user' => $this->zfcUserAuthentication()->getIdentity()));
        $existingCategories = array();

        foreach ($categoriesUser as $categoryUser) {
            $existingCategories[] = $categoryUser->getPrizeCategory()->getId();
        }

        $formPrize->get('prizeCategory')->setAttribute('value', $existingCategories);

        $request = $this->getRequest();
        // I don't want to rely on the browser's info for these key datas
        $request->getPost()->set(
            'identity',
            $this->getUserService()->getAuthService()->getIdentity()->getEmail()
        );
        $request->getPost()->set(
            'email',
            $this->getUserService()->getAuthService()->getIdentity()->getEmail()
        );
        $userId = $this->getUserService()->getAuthService()->getIdentity()->getId();

        $user = $this->getUserService()->getUserMapper()->findById($userId);
        $formInfo->bind($user);

        $username = $formInfo->get('username')->getValue();
        $userFirstLastName = $user->getFirstName().' '.substr($user->getLastName(), 0, 1);
        if (empty($username) || $username == $userFirstLastName) {
            $usernamePoint = '+ 150 pts';
        } else {
            $usernamePoint = '';
        }

        $fmPassword = $this->flashMessenger()->setNamespace('change-password')->getMessages();

        if (isset($fmPassword[0])) {
            $statusPassword = $fmPassword[0];
        } else {
            $statusPassword = null;
        }

        $fmEmail = $this->flashMessenger()->setNamespace('change-email')->getMessages();
        if (isset($fmEmail[0])) {
            $statusEmail = $fmEmail[0];
        } else {
            $statusEmail = null;
        }

        $fmInfo = $this->flashMessenger()->setNamespace('change-info')->getMessages();
        if (isset($fmInfo[0])) {
            $statusInfo = $fmInfo[0];
        } else {
            $statusInfo = null;
        }

        if ($request->isPost() && array_key_exists('firstname', $this->params()->fromPost())) {
            $result = false;
            $data = $request->getPost()->toArray();

            $file = $this->params()->fromFiles('avatar');
            if ($file['name']) {
                $data = array_merge(
                    $data,
                    ['avatar' => $file['name']]
                );
            }

            $result = $this->getUserService()->updateInfo($data, $user);

            if (! $result) {
                return array(
                    'statusPassword' => null,
                    'changePasswordForm' => $formPassword,
                    'statusEmail' => null,
                    'changeEmailForm' => $formEmail,
                    'statusInfo' => false,
                    'changeInfoForm' => $formInfo,
                    'prizeCategoryForm' => $formPrize,
                    'blockAccountForm' => $formBlock,
                    'usernamePoint' => $usernamePoint,
                );
            }

            $this->flashMessenger()->setNamespace('change-info')->addMessage(true);

            $redirect = (!empty($this->params()->fromQuery('redirect')))?
                $this->params()->fromQuery('redirect'):
                $this->getRequest()->getUri();

            return $this->redirect()->toUrl($redirect);
        }

        $redirectUrl = $this->getRequest()->getUri();

        $prg = $this->prg($redirectUrl, true);

        if ($prg instanceof Response) {
            return $prg;
        } elseif ($prg === false) {
            return array(
            'statusPassword' => $statusPassword,
            'changePasswordForm' => $formPassword,
            'statusEmail' => $statusEmail,
            'changeEmailForm' => $formEmail,
            'statusInfo' => $statusInfo,
            'changeInfoForm' => $formInfo,
            'prizeCategoryForm' => $formPrize,
            'blockAccountForm' => $formBlock,
            'usernamePoint' => $usernamePoint,
            );
        }

        if (isset($prg['newCredential'])) {
            $formPassword->setData($prg);
            if (! $formPassword->isValid()) {
                $messages = $formPassword->getMessages();
                if (isset($messages['credential']) && isset($messages['credential']['isEmpty'])) {
                    $messages['credential']['isEmpty'] = 'Saisissez votre mot de passe actuel';
                }
                if (isset($messages['newCredential']) && isset($messages['newCredential']['isEmpty'])) {
                    $messages['newCredential']['isEmpty'] = 'Saisissez votre nouveau mot de passe';
                }
                if (isset($messages['newCredentialVerify']) && isset($messages['newCredentialVerify']['isEmpty'])) {
                    $messages['newCredentialVerify']['isEmpty'] = 'Confirmation du mot de passe ';
                }
                $formPassword->setMessages($messages);

                return array(
                    'statusPassword' => false,
                    'changePasswordForm' => $formPassword,
                    'statusEmail' => null,
                    'changeEmailForm' => $formEmail,
                    'statusInfo' => null,
                    'changeInfoForm' => $formInfo,
                    'prizeCategoryForm' => $formPrize,
                    'blockAccountForm' => $formBlock,
                    'usernamePoint' => $usernamePoint,
                    );
            }

            if (! $this->getUserService()->changePassword($formPassword->getData())) {
                return array(
                'statusPassword' => false,
                'changePasswordForm' => $formPassword,
                'statusEmail' => null,
                'changeEmailForm' => $formEmail,
                'statusInfo' => null,
                'changeInfoForm' => $formInfo,
                'prizeCategoryForm' => $formPrize,
                'blockAccountForm' => $formBlock,
                'usernamePoint' => $usernamePoint,
                );
            }

            $this->flashMessenger()
                ->setNamespace('change-password')
                ->addMessage(true);

            return $this->redirect()->toUrl($this->getRequest()->getUri());
        } elseif (isset($prg['newIdentity'])) {
            $formEmail->setData($prg);

            if (! $formEmail->isValid()) {
                $messages = $formEmail->getMessages();
                if (isset($messages['newIdentity']) && isset($messages['newIdentity']['isEmpty'])) {
                    $messages['newIdentity']['isEmpty'] = 'Saisissez votre nouvel email';
                }
                if (isset($messages['newIdentity']) && isset($messages['newIdentity']['recordFound'])) {
                    $messages['newIdentity']['recordFound'] = 'Cet email existe déjà';
                }
                if (isset($messages['newIdentityVerify']) && isset($messages['newIdentityVerify']['isEmpty'])) {
                    $messages['newIdentityVerify']['isEmpty'] = 'Confirmer votre nouvel email';
                }
                if (isset($messages['newIdentityVerify']) && isset($messages['newIdentityVerify']['notSame'])) {
                    $messages['newIdentityVerify']['notSame'] = 'Les deux emails ne correspondent pas';
                }
                $formEmail->setMessages($messages);

                return array(
                    'statusPassword' => null,
                    'changePasswordForm' => $formPassword,
                    'statusEmail' => false,
                    'changeEmailForm' => $formEmail,
                    'statusInfo' => null,
                    'changeInfoForm' => $formInfo,
                    'prizeCategoryForm' => $formPrize,
                    'blockAccountForm' => $formBlock,
                    'usernamePoint' => $usernamePoint,
                );
            }

            $change = $this->getUserService()->changeEmail($prg);

            if (! $change) {
                $this->flashMessenger()
                ->setNamespace('change-email')
                ->addMessage(false);

                return array(
                    'statusPassword' => null,
                    'changePasswordForm' => $formPassword,
                    'statusEmail' => false,
                    'changeEmailForm' => $formEmail,
                    'statusInfo' => null,
                    'changeInfoForm' => $formInfo,
                    'prizeCategoryForm' => $formPrize,
                    'blockAccountForm' => $formBlock,
                    'usernamePoint' => $usernamePoint,
                );
            }

            $this->flashMessenger()
            ->setNamespace('change-email')
            ->addMessage(true);

            return $this->redirect()->toUrl($this->getRequest()->getUri());
        }

        return array(
            'statusPassword' => null,
            'changePasswordForm' => $formPassword,
            'statusEmail' => null,
            'changeEmailForm' => $formEmail,
            'statusInfo' => null,
            'changeInfoForm' => $formInfo,
            'prizeCategoryForm' => $formPrize,
            'blockAccountForm' => $formBlock,
            'usernamePoint' => $usernamePoint,
            );
    }
1359747
protected function rulesForProfile() : array
    {
        return [
            'first_name' => 'required',
            'last_name' => 'required',
            'gender' => 'required',
            'email' => [
                Rule::unique('users')->ignore(Auth::user()->id),
                'required',
                'email',
            ],
            'nickname' => [
                Rule::unique('users')->ignore(Auth::user()->nickname, 'nickname'),
                'required',
                'max:20',
            ],
            'pictures.storing' => [
                Rule::dimensions()->maxWidth(500)->maxHeight(500),
                'mimes:jpeg,png,jpg',
                'image',
            ],
        ];
    }
70573
protected function getEntityMetaData()
    {
        return [
            $this->getEntityManager()->getMetadataFactory()->getMetadataFor('\JaztecAcl\Entity\Acl\Privilege'),
            $this->getEntityManager()->getMetadataFactory()->getMetadataFor('\JaztecAcl\Entity\Monitor\RequestedPrivilege'),
            $this->getEntityManager()->getMetadataFactory()->getMetadataFor('\JaztecAcl\Entity\Acl\Resource'),
            $this->getEntityManager()->getMetadataFactory()->getMetadataFor('\JaztecAcl\Entity\Acl\Role'),
            $this->getEntityManager()->getMetadataFactory()->getMetadataFor('\JaztecAcl\Entity\Auth\User'),
            $this->getEntityManager()->getMetadataFactory()->getMetadataFor('\JaztecAcl\Entity\Monitor\AclRequest'),
        ];
    }
56810
public function getMutuals()
    {
        if (!isset($this->__mutuals)) {
            $ids = array_intersect($this->leaderIds->toArray(), $this->followerIds->toArray());
            $query = $this->getService('repos:people.person')->getQuery()->where('id', 'IN', $ids);

            $this->__mutuals = $query->toEntitySet();
        }

        return $this->__mutuals;
    }
20061
public function getRelationFiles()
    {
        $filesByObject = new \Mmi\Orm\RecordCollection;
        //wyszukiwanie wartości
        foreach ($this->getAttributeValues() as $record) {
            //pobieranie klucza atrybutu (w celu zgrupowania)
            if ($record->getJoined('cms_attribute_type')->uploader) {
                //dołączanie plików
                foreach (\Cms\Orm\CmsFileQuery::byObject($record->value, $this->_objectId)->find() as $file) {
                    $filesByObject->append($file);
                }
            }
        }
        return $filesByObject;
    }
420294
function get_columns() {

		$profile = ( new Catalog() )->getProfile();

		$columns = [
			'cb' => '<input type="checkbox" />', // Render a checkbox instead of text
			'status' => __( 'Catalog Status', 'pressbooks' ),
			'privacy' => __( 'Privacy Status', 'pressbooks' ),
			'cover' => __( 'Cover', 'pressbooks' ),
			'title' => __( 'Title', 'pressbooks' ),
			'author' => __( 'Author', 'pressbooks' ),
		];

		for ( $i = 1; $i <= Catalog::MAX_TAGS_GROUP; ++$i ) {
			$columns[ "tag_{$i}" ] = ! empty( $profile[ "pb_catalog_tag_{$i}_name" ] ) ? $profile[ "pb_catalog_tag_{$i}_name" ] : __( 'Tag', 'pressbooks' ) . " $i";
		}

		$columns['featured'] = __( 'Featured', 'pressbooks' );
		$columns['pub_date'] = __( 'Pub Date', 'pressbooks' );

		return $columns;
	}
1320231
public function getAllProfilesAction()
    {
        $profiles = [];
        /** @var Repository $repo */
        $repo = $this->get($this->getParameter('ongr_settings.repo'));

        $search = $repo->createSearch();
        $search->addAggregation(new TermsAggregation('profiles', 'profile'));

        /** @var DocumentIterator $result */
        $result = $repo->findDocuments($search);

        /** @var AggregationValue $agg */
        foreach ($result->getAggregation('profiles') as $agg) {
            $profiles[] = $agg->getValue('key');
        }

        if (empty($profiles) || !in_array('default', $profiles)) {
            array_unshift($profiles, 'default');
        }

        return new JsonResponse($profiles);
    }
897613
public function getPageMainZones()
    {
        $result = array();

        if (null === $this->getLayout()) {
            return $result;
        }

        $currentpageRootZones = $this->getContentSet();
        $layoutZones = $this->getLayout()->getZones();
        $count = count($layoutZones);
        for ($i = 0; $i < $count; $i++) {
            $zoneInfos = $layoutZones[$i];
            $currentZone = $currentpageRootZones->item($i);

            if (
                null !== $currentZone
                && null !== $zoneInfos
                && true === property_exists($zoneInfos, 'mainZone')
                && true === $zoneInfos->mainZone
            ) {
                $result[$currentZone->getUid()] = $currentZone;
            }
        }

        return $result;
    }
285010
public function profile()
    {
        $user = $this->Users->get($this->Auth->user('id'));

        if ($this->request->is('put') && !empty($this->request->data)) {
            /** @var User $user */
            $user = $this->Users->patchEntity($user, $this->request->data);
            if ($this->Users->save($user)) {
                $this->Auth->setUser(Hash::merge($this->Auth->user(), $user->toArray()));
                $this->Flash->success(__d('wasabi_core', 'Your profile has been updated.'));
                $this->redirect(['action' => 'profile']);
                return;
            } else {
                $this->Flash->error($this->formErrorMessage);
            }
        }

        $this->set([
            'user' => $user,
            'languages' => Hash::map(Configure::read('languages.backend'), '{n}', function ($language) {
                return [
                    'value' => $language->id,
                    'text' => $language->name
                ];
            })
        ]);
    }
1325078
public function getAllProfileInfo()
    {
        if (empty($this->_profiles)) {
            return '';
        }

        $arrOut = [];
        foreach ($this->_profiles as $name => $val) {
            if (!isset($val['cost'], $val['total'])) {
                continue;
            }
            $arrOut[] = "$name=" . sprintf("%.1f", $val['cost'] * 1000) . '(ms)/' . $val['total'];
        }

        return implode(',', $arrOut);
    }
7515
public function profile($values)
    {
        $profile = [];

        foreach (array_keys($values) as $field) {
            $profile[$field] = '';
        }

        return $profile;
    }
845772
public static function getDbProfilerHtml()
    {
        $percentSum = 0;
        $html = '';
        $profilerData = \App\Registry::$db && \App\Registry::$db->getProfiler() ? \App\Registry::$db->getProfiler()->get() : [];
        //brak zapytań
        if (!count($profilerData)) {
            return 'No SQL queries';
        }
        //pętla po profilerze
        foreach ($profilerData as $index => $event) {
            $percentSum += $event['percent'];
            $html .= '<div style="color: #' . self::_colorifyPercent($event['percent']) . '"><div style="float: left; width: 450px; margin-right: 20px; font-size: 10px; word-wrap: break-word; white-space: pre-wrap;">' . ($index + 1) . '. '. $event['sql'] . '</div><div style="float: left; width: 60px;"><b>' . round($event['elapsed'], 4) . 's</b></div><div style="float: left; width: 60px;"><b>' . round($event['percent'], 2) . '%</b></div><div style="float: left;"><b>' . round($percentSum, 2) . '%</b></div></div><div style="clear: both"></div>';
        }
        return $html;
    }
930529
public function profiles()
    {
        if (is_null($this->profileRequests)) {
            $this->profileRequests = new ProfileRequests($this->client);
        }

        return $this->profileRequests;
    }
354288
public function getData()
    {
        return [
            'user___user__view_profile' => 'View user profile',
            'user___user__view_own_profile' => [
                'type' => Item::TYPE_PERMISSION,
                'description' => 'View user own profile',
                'rule' => new UpdateOwnDataRule(),
                'children' => ['user___user__view_profile']
            ],
            'user' => [
                'type' => Item::TYPE_ROLE,
                'description' => 'User',
                'children' => ['user___user__view_own_profile'],
            ],
            'admin' => [
                'type' => Item::TYPE_ROLE,
                'description' => 'Admin',
                'children' => ['user___user__view_profile']
            ],
            'owner' => [
                'type' => Item::TYPE_ROLE,
                'description' => 'Application owner',
                'children' => ['admin'],
            ]
        ];
    }
1259298
public function getProfilCourantFormulaire()
    {
        $retour=array();
        
        $idProfilCourant = 1;
        if (isset($this->variablesGet['archiIdProfil'])
            && $this->variablesGet['archiIdProfil']!=''
            && $this->variablesGet['archiIdProfil']!='0'
        ) {
            $idProfilCourant = $this->variablesGet['archiIdProfil'];
        }
        
        $req = "SELECT libelle,idProfil FROM droitsProfils
            WHERE idProfil='".$idProfilCourant."'";
        $res = $this->connexionBdd->requete($req);
        $fetch = mysql_fetch_assoc($res);
        $retour=array('libelle'=>$fetch['libelle'],"idProfil"=>$fetch['idProfil']);
        return $retour;
    }
535255
public function meta()
    {
        return [
            'Command' => e($this->meta['scheduler']->command),
            'Schedule' => e($this->meta['scheduler']->schedule),
            'Started at' => e($this->meta['scheduler']->last_run->diffForHumans()),
            'Your alert threshold' => e($this->meta['scheduler']->alert_run_time_greater_than).' seconds',
        ];
    }